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
110
GroupByArea.Collapsed / Expanded event not firing?
posted

Hi folks,

I have a checkbox which is bound via a viewmodel to the IsGroupByAreaExpanded  property on a XamDataGrid (9.2).  The check box binding is set up like this in XAML.

      <CheckBox Name="chkGroupByArea" IsChecked="{Binding IsGroupByAreaExpanded, Mode=TwoWay}">Show Group By Area</CheckBox>

The viewmodel property just passes through the IsChecked value to the IsGroupByAreaExpanded property on the XamDataGrid. 

This works fine when setting/clearing the checkbox; the GroupByArea expands and collapses correctly.  My problem comes when the user expands or collapses the GroupByArea manually I need to send a propertychanged notification from the ViewModel so the checkbox updates appropriately, but the Expanded and Collapsed Events don't fire.

I've tried trapping them in the viewmodel like so:

  this.dataGrid.GroupByArea.Expanded += new RoutedEventHandler(GroupByArea_Changed);
  this.dataGrid.GroupByArea.Collapsed += new RoutedEventHandler(GroupByArea_Changed);    

to no avail, and also in the XAML/Code-Behind in the view like this...

<igDP:XamDataGrid.GroupByArea>
   <igDP:GroupByArea Collapsed="GroupByArea_Collapsed" Expanded="GroupByArea_Expanded"/>
</igDP:XamDataGrid.GroupByArea>

Again, no joy.  What am I doing wrong?

Cheers
David