I am working on a Behavior to extend the GridView with CheckBoxes inside the group headers. To achieve this I created a System.Windows.Interactivity.Behavior where in the "Loaded" event of the GridView I add Eventhandlers to all Checkboxes in the group headers. To get a list of all GroupHeaderRow items I use the following code:
This is working as expected, I get all group headers and can work with them. (Note: the "AssociatedObject" is the GridView to which the Behavior is attached to; the GroupRenderMode is "Flat".)
When a user changes the grouping be dragging/dropping a column to/from the group panel the "Grouped" event occurs. Unfortunately the list of GroupHeaderRow items is empty right after this event occurs and using the code above. On the other side I tried to respond to the "GroupDescriptors.CollectionChanged" event, but the list of GroupHeaderRows has not been refreshed which means I get the GroupHeaderRows of the old grouping before the collection was changed.
Now I am stuck. How can I get the list of all current GroupHeaderRow items after the user changed the grouping via UI?
Second question: how can I get the GroupHeaderRow that a selected item belongs to when I respond to the "SelectionChanged" event of the GridView?
TIA
Neils
var groupHeaderRows =
AssociatedObject.ChildrenOfType<GroupHeaderRow>().ToList();
This is working as expected, I get all group headers and can work with them. (Note: the "AssociatedObject" is the GridView to which the Behavior is attached to; the GroupRenderMode is "Flat".)
When a user changes the grouping be dragging/dropping a column to/from the group panel the "Grouped" event occurs. Unfortunately the list of GroupHeaderRow items is empty right after this event occurs and using the code above. On the other side I tried to respond to the "GroupDescriptors.CollectionChanged" event, but the list of GroupHeaderRows has not been refreshed which means I get the GroupHeaderRows of the old grouping before the collection was changed.
Now I am stuck. How can I get the list of all current GroupHeaderRow items after the user changed the grouping via UI?
Second question: how can I get the GroupHeaderRow that a selected item belongs to when I respond to the "SelectionChanged" event of the GridView?
TIA
Neils