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
40
SelectedItems of XamGrid
posted

Is there a way to bind a SelectedItems property to a viewmodel? I realize this property exists for XamDataGrid, but I am looking for one for XamGrid specifically.

I found this post but the sample download link no longer works: 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

  • 6365
    Offline posted

    Hello Corey,

    Thank you for providing the blog post link you have used.

    In order to bind for the Data items of the currently selected Rows in the XamGrid by using a behavior (could be done by extending the XamGrid as well), I can suggest you create a Dependency Property inside the behavior class and bind the respective property from the ViewModel to it.

    This way you can get all the Data items of the selected rows in your ViewModel class. Please note that in order to use a two-way binding, you would need to follow and implement the same steps that are mentioned in the blog post you have referred to.

    I have attached a sample application that uses the approach from above. You should be able to use it as a starting point for your application.

    If you have any further questions, please let me know.

    XamGrid_sample.zip