简体   繁体   English

在WPF DataGrid中设置垂直滚动条位置

[英]Setting Vertical Scrollbar position in WPF DataGrid

I've a datagrid in WPF, It has lots of records hence having a VerticalScrollBar, when i do some activity like delete in some where at bottom of the screen and after this activity set the first index of the row, First row has been selected but scrollbar remains at the same position(bottom). 我在WPF中有一个数据网格,它有很多记录,因此有一个VerticalScrollBar,当我在屏幕底部的某些位置执行诸如删除之类的活动时,在此活动设置了该行的第一个索引之后,就选择了第一行但滚动条保持在相同位置(底部)。 I want it to be at the top or wherever the selected row is. 我希望它位于顶部或所选行的任何位置。

Thanks 谢谢

After you perform the delete, you can use a combination of UpdateLayout and ScrollIntoView DataGrid methods. 执行删除后,可以结合使用UpdateLayout和ScrollIntoView DataGrid方法。 Ensure you call the UpdateLayout method before calling the ScrollIntoView method. 确保在调用ScrollIntoView方法之前先调用UpdateLayout方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM