Hi
Im using MVVM model with my xamdatagrid and I have to refresh my filtered count in a label.
Ive used Interaction triggers. But dont know how to access the method RecordManager.GetFilteredInDataRecords() from my viewmodel.
In my XAML:
<i:Interaction.Triggers> <i:EventTrigger EventName="RecordsInViewChanged" SourceName="dgRecords"> <ei:CallMethodAction MethodName="RecordsInViewChanged" TargetObject="{StaticResource lvm}"/> </i:EventTrigger> </i:Interaction.Triggers>
My Viewmodel:
public void RecordsInViewChanged(object sender, Infragistics.Windows.DataPresenter.Events.RecordsInViewChangedEventArgs e) { DependencyObject source = e.OriginalSource as DependencyObject; if (source == null) return;
??? }
Need to get the grid's count at any time in view model and update it in a lable
Thanks for your help. Fixed my issues with ur reply
Hello rathna lal,
Have you tried the suggestion provided by Slavi?
Please feel free to let us know if you have any other questions with this matter.
Isn't the sender the XamDataGrid ? [the original source should also be the XDG] If so you can try this:
private void XDG_RecordsInViewChanged(object sender, Infragistics.Windows.DataPresenter.Events.RecordsInViewChangedEventArgs e)
{
var dataGrid = sender as XamDataGrid;
var count = dataGrid.RecordManager.GetFilteredInDataRecords().Count();
}
Let me know if this is what you were looking for.
Thanks,
Slavi