.Net 4 WPF DataGrid C# MMVM
When the DataGrid SelectionUnit is full row, wpf databinding and the collectionview take care of letting me know in the viewmodel what is the actively selected item via the view's currentitem property. This works great for readonly grids with the selection mode set to the fullrow.
Now I have an editable grid. So I set the SelectionUnit=Cell to make it easier to spot which cell one is in. Now all of a sudden the grid no longer has any ability to track the selection item. I can't even set SelectedItem when set to cell mode. So now the viewmodel always thinks it's on the first row. I can handle SelectedCellsChanged in the grid to figure out what row I'm on, I just have no way of letting the viewmodel know since the grid's SelectedItem can no longer be set!
I don't understand why the grid can't still have a SelectedItem when in cell select mode.
Short of hardcoding into my grid to cast the ItemSource to my collectionview to call MoveCurrentTo from the SelectedCellsChanged event, is there any other MVVM true way to keep the view's CurrentItem in sync with the grid?
Either that, or I change the grid style to remove or reduce the row highlight effect when I have an editable grid.
DataGrid
source and inCell
mode, they don't sync withSelectedItem
– Jake Berger