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
781
Bind SelectedRow in XamGrid
posted

Hi,

how can i bind the selected row to my viewmodel? My problem is this: i bound the itemssource to the vm (works fine, the elements are shown) but in the code behind of the view the xamgrid has no rows. So i cannot set the selected row this way:  myxamgrid.SelectionSettings.SelectedRows.Add(selectedRow);

What can i do?

Parents
No Data
Reply
  • 220
    posted

    You may want to try this:

     

     

     

    private void GridReview_SelectedRowsCollectionChanged(object sender, SelectionCollectionChangedEventArgs<SelectedRowsCollection> e)
    {
       _viewModel.SelectedItemModel = e.NewSelectedItems.SingleOrDefault().Data
    as ItemModel;
    }

Children