Hi
I have a multi level grouping (let's say two groups) and one of the column is Checkbox column.
My functionality is when I select the checkBox in Header column I should be able to loop through all the group row level checkboxes and select all the check boxes in group level rows.
and when I select the checkBox in group1 (let's main group) I should be able to loop through all the sub-group level checkboxes and select all the check boxes in sub-group level rows.
I am able to select the corresponding checkBoxes in the actual data rows on the selection of Header checkbox/main group checkbox/Sub-group checkbox but could not get hold of group level checkboxes.
Can some please help on this?
Thanks
Sayap
Hi Sayap,
To access the row data of a particular GroupByRow, you can use:
RowCollection rows = ((GroupByRow)this.grid1.Rows[0]).Rows;
foreach (Row row in rows)
{
}
Hope this helps,
-SteveZ
Hi Steve
How can identify the actual GroupbyRow in a xamgrid?
When I click on a column header (with a checkbox), how to get the row collection?
Harold E.
Hi Steve,
I got the same question as Harold E. How do we get the row collection? (given user clicks on the checkbox from the sub group level header row, so that I can only select/unselect the belonging rows' checkboxes)
Please advise.
Chris L
Infragistics team,
Any update?
Hi,
Assuming your checkbox is defined in the header using a HeaderTemplate:
<ig:CheckBoxColumn Key="Bool"> <ig:CheckBoxColumn.HeaderTemplate> <DataTemplate> <CheckBox Click="CheckBox_Click" /> </DataTemplate> </ig:CheckBoxColumn.HeaderTemplate> </ig:CheckBoxColumn>
You can access all rows in the given collection with the following code:
private void CheckBox_Click(object sender, RoutedEventArgs e) { CheckBox cb = (CheckBox)sender; HeaderCellControl cell = (HeaderCellControl)cb.Parent; foreach (RowBase row in cell.Cell.Row.Manager.Rows) { if (row.RowType == RowType.DataRow) { ((MyDataObject)row.Data).Bool = (bool)cb.IsChecked; } } }
Georgi,
I am using Silverlight XamGrid and while checking on the API, I can't find the Row.Manager class inside your foreach code snippnet.(http://help.infragistics.com/Help/Doc/Silverlight/2011.1/CLR4.0/html/InfragisticsSL4.Controls.Grids.XamGrid.v11.1~Infragistics.Controls.Grids.RowBase_members.html)
Please advise if I am doing anything wrong.
It's there, but it's hidden from the intellisense (and the API docs) on purpose, as it's supposed to be used for internal purposes only.
You should be able to use it though. Did you try the snippet I provided?
Regards,
Yes, thanks. It's working.
Chris