如何使用按键导航数据网格?

发布于 2024-07-18 07:15:18 字数 163 浏览 2 评论 0原文

在我看来,我记得我的 DataGrid 曾经能够将我带到排序列的第一行,其中文本以与按下的键相同的字母开头,即键入“k”,光标将位于该行以“Kenny”为内容。 我不知道我是否意外禁用了此属性,或者将此功能与我已经以这种方式导航的树视图混淆了。 是否有我无意中禁用的属性? 另外,这个功能的官方术语是什么?

It seems to me I remember that my DataGrid was once able to take me to the first row of a sorted column with the text starting with the same letter as a pressed key, i.e. type 'k' and the cursor would be located at the row with 'Kenny' as the contents. I don't know if I've accidently disabled this property or am confusing this feature with my treeview which navigates this way already. Is there a property I've inadvertently disabled? Also, what is the official term for this feature?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

(り薆情海 2024-07-25 07:15:18

我认为 DataGrid 类中没有内置功能可以执行此操作。 我发现重写 Datagrid 类的 OnKeyDown 或 OnKeyPress 可以很容易地模拟这一点。

`
NavDataGrid 类:System.Windows.Forms.DataGrid
{
protected override void OnKeyDown(System.Windows.Forms.KeyEventArgs ke)
{
基.OnKeyDown(ke);
//在这里处理导航
}
}

`

I don't think there is a built in feature to do this in the DataGrid class. I have found that overriding the OnKeyDown or OnKeyPress of the Datagrid class can simulate this pretty easily.

`
class NavDataGrid : System.Windows.Forms.DataGrid
{
protected override void OnKeyDown(System.Windows.Forms.KeyEventArgs ke)
{
base.OnKeyDown(ke);
//handle navigation here
}
}

`

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文