Normally when I have a datagid in my view, in my view model I have a property to bind the SelectedIndex that the datagrid notifies when I select an item in the datagrid.
However, I notice that if I short the datagrid by a column, the selectedIndex that the datagrid notifies is not the correct position of the item in the observableCollection of the view model that has the items of the view. This is because the datagrid notifies the position of the shorted element but the view model has the original order in the observableCollection, then if in my view model try to use the selectedIndex to select the element in the observableCollection, I get an item that is not the expected one.
If I use the selectedItem, I don't have this problem, because in the view model I have a property that always has the item that the datagrid says that is selected, no matter the position.
So how my objective is to get the correct selectedItem in my view model, and I have the two options, to use the selectedIndex and the selectedItem, and after the problem that I have described, I don't know when it could be useful to use selectedIndex instead of selectedItem.
My general question is, when to use selectedIndex and when SelectedItem?
Both cases are acceptable, and use them depends on your case.
More details : Binding SelectedItem vs SelectedIndex - When should I choose one over the other?