Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
640
How to get all data items under a group header?
posted

I have a XamDataGrid that is binded to a list of 'MyItem' objects.

I am trying to add a context-menu to group headers in my XamDataGrid, so I have the following defined in my Xaml file:

<ContextMenu x:Key="contextMenu_GroupByRecordPresenter">

  <MenuItem x:Name="menuItemCheckItems" Header="Check Items"

            Click="menuItemGRP_CheckItems_Click" />

  <MenuItem x:Name="menuItemOpenItems" Header="Open Items" Click="…"  />

</ContextMenu>

  

<Style TargetType="{x:Type igDP:GroupByRecordPresenter}">

  <Setter Property="ContextMenu"

         Value="{StaticResource contextMenu_GroupByRecordPresenter}" />

  <EventSetter Event="ContextMenuOpening" Handler="GRP_ContextMenuOpening" />

</Style>

 

And in the code behind:

private void menuItemGRP_CheckItems_Click(object sender, RoutedEventArgs e)

{ }

When the user selects the 'Check Items' item on the context-menu, I need to get all the 'MyItem' objects under this group header.

So, in code behind

  1. How do I get them?

  2. I may need to disable the 'Check items' item in the context-menu if the group header contains other group-headers under it, so how can I know that?