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
345
Event triggers Xamdatagrid
posted

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

  • 20872
    Offline posted

    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.

  • 890
    posted

    Hi

     

    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