Ultragrid header checkbox

3.7k Views Asked by At

I got a ultragrid with a column "A" that has a checkbox. How can I know if on all my rows this column is checked? Because there is a general checkbox that can be used to alter the state of column "A" in all my rows by using CheckAll() function, so it has to be a way to know if all my rows have this column checked, right?

Thanks in advance.

Btw: I tried to use GetHeaderCheckedState function but as I have group by rows I need to use the GetAllNonGroupByRows() function that returns an array of UltraGridRow, and the GetHeaderCheckedState function only receives a RowsCollection... Is there some way to convert UltraGridRow[] to RowsCollection?

PS:I don't know if this makes some kind of difference but this is a non-web application in C#.

1

There are 1 best solutions below

0
On

Depending on your scenario, you may be able to use either the BeforeHeaderCheckStateChanged or AfterHeaderCheckStateChanged event on the UltraGrid. This would allow you to use the RowCollection property on the incoming EventArgs. For example:

private void ultraGrid1_BeforeHeaderCheckStateChanged(object sender, BeforeHeaderCheckStateChangedEventArgs e)
{
    ultraGrid1.DisplayLayout.Bands[0].Columns[0].GetHeaderCheckedState(e.Rows);
}

If this approach is not suitable for your scenario, you could use the parent rows. For example:

ultraGrid1.DisplayLayout.Bands[0].Columns[0].GetHeaderCheckedState(ultraGrid1.ActiveRow.ChildBands[0].Rows);