WPF DataGrid - 添加新行时如何保持专注于DataGrid的底部? [英] WPF DataGrid - How to stay focused on the bottom of the DataGrid as new rows are added?

查看:277
本文介绍了WPF DataGrid - 添加新行时如何保持专注于DataGrid的底部?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 DataGrid WPF工具包和我需要能够保持焦点在网格的底部(即最后一行)。我现在遇到的问题是,随着行的添加, DataGrid 的滚动条不会随着要添加的新行滚动。什么是最好的方法来完成这个?

I am using DataGrid from the WPF Toolkit and I need to be able to maintain focus on the bottom of the grid (i.e. the last row). The problem I'm having right now is that as rows are added the scrollbar for the DataGrid doesn't scroll along with the new rows being added. What's the best way to accomplish this?

推荐答案

看起来像 DataGrid.ScrollIntoView(< item>) 将保持专注于 DataGrid 的底部。

这篇关于WPF DataGrid - 添加新行时如何保持专注于DataGrid的底部?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆