WPF DataGrid ScrollView有问题吗? [英] WPF DataGrid ScrollView Problems?
本文介绍了WPF DataGrid ScrollView有问题吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
在My WPF&DataGrid中有超过5000条记录.
In My WPF DataGrid having more than 5000 records.
现在,我的数据网格的选定索引为4000.
Now my datagrid selected Index is 4000.
我将从一个按钮更改SelectedIndex = 0.
I will change the SelectedIndex=0 from One Button.
我想在View中显示SelectedItem.所以
i want to show the SelectedItem in View. so
在这里,我正在使用dataGrid.ScrollIntoView(dataGrid.SelectedItem).
here i am using dataGrid.ScrollIntoView(dataGrid.SelectedItem).
它没有显示selectedIndex = 0;
Its not showing selectedIndex=0;
为什么?解决方案是什么?有人可以建议这个吗?
why? what is the Solution for this? can anyone suggest this?
推荐答案
尝试在ScrollintoView之前插入dataGrid.UpdateLayout().
Try inserting dataGrid.UpdateLayout() before your ScrollintoView.
类似的东西:
dataGrid.SelectedItem = whatever;
dataGrid.UpdateLayout();
dataGrid.ScrollIntoView(dataGrid.SelectedItem);
这篇关于WPF DataGrid ScrollView有问题吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文