How to ensure the current item of a WPF data grid is visible?
I have a WPF DataGrid with IsSynchronizedWithCurrentItem set to true and binding it to an ObservableCollection. When use a ICollectionView.MoveCurrentTo* method to change the current item the DataGrid changes its current item accordingly.
The problem I'm having is that if the current item is not currently visible the DataGrid doe开发者_运维百科s not scroll the current item into view. How do I fix this?
You might be able to handle ICollectionView.CurrentChanged
and call DataGrid.ScrollIntoView(object item)
from it to achieve that.
精彩评论