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
Programmatically selecting a record in XamDataGrid in a viewmodel

Is it possible to programmatically select a record in a XamDataGrid in a viewmodel.

I've seen some posts how you can do this in the code behind of the xaml but i would prefer not to do that and select the record in my viewmodel.

Any help would be appreciated.

  • 30890
    Offline posted

    Hello Michael,

    In order to programmatically select a record in your XamDataGrid from the ViewModel, I would recommend binding the SelectedDataItem or SelectedDataItems properties of the grid (depending on if you want single or multiple selection). Here is a documentation article about working with the Selected Data Items of the XamDataGrid.

    Please let me know if you have any other questions or concerns on this matter.

Reply Children