Hi
I have a readonly xamgrid. I have bound my viewmodel class to the grid to populate data. What I want is to get the currently selected record or row index in my view model. Please kindly note I cannot make my grid editable.
Thanks,
Chev
Hello Chev,
One option to get the currently selected records in your view model using MVVM is to use a behavior to bind the currently selected records to a collection in your view model. You could also bind to the ActiveItem property.
In the attached sample that displays the first option above, the view model’s collection property named Selected is bound to the SelectedItems property of the custom behavior. The behavior gets the records of the row of the XamGrid that is selected and drops them into the Selected collection. I have bound that collection to a ListBox to provide a visual cue on how it is working.
For more about behaviors see: http://ko.infragistics.com/community/blogs/devin_rader/archive/2011/06/01/using-behaviors-to-synchronize-selected-items-of-infragistics-silverlight-controls-to-a-viewmodel.aspx
Please let me know if you have any questions or concerns.
Sincerely,AndrewDeveloper Support IInfragistics Inc.www.infragistics.com/support
Just checking in. Do you have any other questions or concerns?