c# ListView 聚焦于第二列

发布于 2024-08-30 15:13:05 字数 172 浏览 1 评论 0原文

我有一个包含几列的 ListView,假设按 A、B、C、D 列的顺序,按 A 列排序。在长列表中,我可以按键盘上的一个字母,然后向下滚动到 A 列中开头的第一项按下该字母。

在开头插入了一个新列,但我仍然希望能够按键盘上的字母并根据 A 列(现在是第二列)中的值滚动。如何将焦点设置回 A 列而不将其设为第一列?

I have a ListView with several columns, let's say column A,B,C,D in that order, sorted by column A. In long lists I could press a letter on my keyboard and scroll down to the first item in column A that begins with the letter pressed.

A new column has been inserted at the beginning, yet I still want to be able to press a letter on my keyboard and scroll according to the values in column A which is now the second column. How can I set the focus back to column A without making it the first column?

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

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

发布评论

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

评论(1

神仙妹妹 2024-09-06 15:13:05

击键匹配始终发生在第一列上,即 Index = 0 的列上。如果您的新列(称为 E 列)现在是第一列,则将在其上发生文本匹配。

您可以通过使用列上的 DisplayIndex 属性来更改列的显示顺序,使 E 列出现在 A 列之前。

因此,要使 E 列显示为第一列,A 列显示为第二列,并且要在 A 列上进行文本搜索,您需要设置如下属性:

A 列:
索引 = 0
DisplayIndex = 1

列 E:
索引 = 1 /* 或 5 或其他 */
显示索引 = 0

Matching on keystrokes always happen on the first column, that is on the column with Index = 0. If your new column (call it column E) is now the first column, text matching will occur on it.

You can change the display order of the columns, so that column E simply appears before column A, by playing with the DisplayIndex property on the column.

So, to make column E appear as the first column and column A appear as the second column, AND for text searching to work on column A, you need to set the properties like this:

column A:
Index = 0
DisplayIndex = 1

column E:
Index = 1 /* or 5 or whatever */
DisplayIndex = 0

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