Question

My question is "Is there a way to use a CheckBox inside a fixed row cell in a C1.Win.C1FlexGrid?".

I have a C1FlexGrid with two Fixed rows. (It is important to mention here that I am using the C1.Win.C1FlexGrid grid and not the WPF, or SilverLight version)

The first fixed row I have is used for the headers as usual. the second one though is customized to perform some other tasks all is working fine except for one task I can't get done. I need to use a CheckBox inside one cell of the cells of the second Fixed row (just like any Boolean cell in the grid's normal rows) because I want to use this CheckBox to Check/Uncheck all check boxes in the same column.

Of course setting the column datatype to bool won't do the job for fixed rows. Setting the editor of the cell to a CheckBox won't do also as the editor won't be visible at all times but only when cell is selected. Also, based on my research, there is a CellFactory property that some threads are discussing which can be used to do this job, but CellFactory is not implemented in C1.Win.C1FlexGrid class but only in WPF, SilverLight and Phone versions of the grid.

Any ideas on how to do this?

Was it helpful?

Solution

Create a new CellStyle with a Boolean DataType and set it to any Cell that you need. Here’s the code to implement it, assuming the cell is in Row 1 and Column 1:

//Implement 2 fixed rows
c1FlexGrid1.Rows.Fixed = 2;
//create and set a new style to the reqd. cell
var cs = c1FlexGrid1.Styles.Add("Boolean");
//set DataType
cs.DataType = typeof(Boolean);
//Set any alignment
cs.ImageAlign = C1.Win.C1FlexGrid.ImageAlignEnum.CenterCenter;
c1FlexGrid1.SetCellStyle(1, 1, cs);

Thanks, Richa

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top