开发者

How to ensure the current item of a WPF data grid is visible?

开发者 https://www.devze.com 2023-02-07 14:17 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号