If I right mouse click on the "Key" column header, how can I get all the 4 rows under group CCC?
Thanks for your help!
Amy
Assuming that the rows in the image above were selected as a result of right clicking the Key column header...
You can get a collection of selected rows via: ultraGrid1.Selected.Rows.
Otherwise you will have to come up with an event pattern to highlight all rows in the grouping before using the suggested code above.
I need to make one correction to my original email, the rows are not selected.
How can I get the all the rows in the grouping when I click on the Column Header?
Thanks for you help!
Worked.
Thanks Mike!
Hi Amy,
Here's some sample code to get the rows.
private void ultraGrid1_MouseDown(object sender, MouseEventArgs e) { UltraGrid grid = (UltraGrid)sender; if (e.Button == MouseButtons.Right) { UIElement element = grid.DisplayLayout.UIElement.LastElementEntered; if (null == element) return; HeaderUIElement headerUIElement = element.GetAncestor(typeof(HeaderUIElement)) as HeaderUIElement; if (null == headerUIElement) return; RowsCollection rows = headerUIElement.GetContext(typeof(RowsCollection)) as RowsCollection; if (null == rows) return; foreach (UltraGridRow row in rows) Debug.WriteLine(row.Cells["Key"].Text); } }