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
580
WPF MVVM xamgrid Selection Event
posted

Hi,

We are implementing a MVVM architecture in our WPF application. We want to use the XamDataGrid but kind of lost about implementing the selection changed event on the view model layer.

Any help will be greatly appreciated.

We need a solution urgently!!!

Anshuman Chakravarty
Humana Inc.

  • 580
    Verified Answer
    posted

    Guys, I have solved the above issue. I did it in a very simple way.

    Bind the ActiveCell property of the XamGrid to an object type property in the VM. 
    In the setter of the property, call a method and pass the object.  
    Inside the method, cast the object to Infragictics.Windows.Cell type variable. 
    Use the Infragistics.Windows.Cell object's Record.Index to find the Selected Index. 
    Using that index, find the row selected from the original collection/data source to which the xamdatagrid was binded.

    Simple, but effective!!!