在启用 VirtualMode 的情况下聚焦 ListView 中的项目

发布于 2024-09-25 09:25:22 字数 160 浏览 1 评论 0原文

我有一个虚拟模式下的列表视图。

我需要一种方法将焦点集中到特定项目。

FocusedItem 对于 VirtualMode 来说不好,我需要一种方法来设置 FocusedIndex 或类似的东西,但没有看到任何类似的属性。

谢谢。

I have a ListView in VirtualMode.

I need a way to set focus to specific item.

The FocusedItem is not good for the VirtualMode, I need a way to set FocusedIndex or something like that, but didn't see any property like that.

Thanks.

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

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

发布评论

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

评论(2

陌上芳菲 2024-10-02 09:25:22

您必须直接在 ListViewItem 上设置 Focused 属性。

因此,要将第 11 行设置为焦点:

this.lvVirtual.Items[10].Focused = true;

You have to set the Focused property on the ListViewItem directly.

So, to set the 11th row to be focused:

this.lvVirtual.Items[10].Focused = true;
深巷少女 2024-10-02 09:25:22

正如前面所说,ListView 处于 VirtualMode 模式。此处无法访问 Items 集合。

尝试引发事件VirtualItemsSelectionRangeChanged

As it has been said ListView is in VirtualMode. Items collection is not accessible here.

Try to raise an event VirtualItemsSelectionRangeChanged

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