Search code examples
wpfmvvminfragisticsselectionchangedxamdatagrid

Infragistics XamDataGrid WPF MVVM SelectionChanged


We are implementing a MVVM architecture in our WPF application. We want to use the Infragistics 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.


Solution

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

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

    Simple, but effective!!!