Hiding individual checkboxes in a Checkbox column
Hi Dapfor,
I have a requirement, that when a row contains certain values in other cells, the checkbox in the Checkbox cell should be hidden and the cell should appear blank and not editable.
I was able to previously use the topic, Turning off the cell editable property, but the new requirement makes it necessary that the check box becomes invisible.
How can I do this?
0
-
Hi,
You can do it by implementing your own editor that doesn’t paint text in cells. You can setup this editor in Grid.CellEditor event:
grid1.CellEditor += delegate(object sender, GridCellEditableEventArgs e)
{
Row row = e.Cell.Row;
Column column = e.Cell.Column;
if (your conditions here)
{
e.Editor = new EmptyEditor();
e.Editable = false;
}
};
class EmptyEditor : UITypeEditorEx
{
public override bool GetPaintCellSupported()
{
return true;
}
public override void PaintCell(PaintCellEventArgs e)
{
e.Parts &= e.Parts ^ PaintPart.Text;
base.PaintCell(e);
}
}
Best regards,
The Dapfor Team0
Please sign in to leave a comment.
Comments
1 comment