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
720
Readonly Xamgrid get active row index
posted

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

Parents
No Data
Reply
  • 34830
    Offline posted

    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://es.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,
    Andrew
    Developer Support I
    Infragistics Inc.
    www.infragistics.com/support

    MVVMCurrentSelectedRecordCase.zip
Children