I am using 15.3.0.26 WPF SfDataGrid in MVVM application.
In response to a click from the user, the viewmodel needs the filtered records from the SfDataGrid. Using FilterChanged event, I can get the filtered records when the filter changes. However, the underlying collection might change (and change the filtered record set) between the time the filter was changed and when I need the filtered records.
I would like to use the CollectionChanged event, but I can't register a handler for it. In https://www.syncfusion.com/forums/120981/event-that-triggered-when-added-new-row, it shows adding the CollectionChanged handler during the Loaded event handling. In my case, the SfDataGrid.View property is null when datagrid_Loaded is called, so I can't add the new CollectionChanged handler.
How can I handle the CollectionChanged event?
It would be even better if I could do this in XAML. I've tried the following, but (perhaps not surprisingly) the command never gets executed.
<i:Interaction.Triggers>
<i:EventTrigger EventName="CollectionChanged">
<i:InvokeCommandAction Command="{Binding CollectionChangedCommand}"
CommandParameter="{Binding ElementName=sfgrid }" />
</i:EventTrigger>
</i:Interaction.Triggers>