设置选项卡索引

发布于 2024-07-27 04:56:59 字数 207 浏览 3 评论 0原文

在 wpf 文本框中具有 TabIndex 属性来设置选项卡顺序,当控件位于同一上下文中时,这工作正常,在我的情况下,我有一个列表框,其 itemstyle 有一个文本框,并且样式是根据触发器动态分配的。 现在我该如何进行制表符索引,以便当我制表符索引从第一个列表框项中的文本框移动到下一个列表框项中的文本框或组合框或按钮以及进一步的列表框项时。

谢谢

阿温德

In wpf Textbox has TabIndex property to set the tab order, this is working fine when the controls are in the same context, In my case i have a listbox whose itemstyle has a text box and the style is assigned dynamically based on trigger. now how can i do the tabindexing so that when i tab index moves from textbox in first listboxitem to the textbox or combobox or button in the next listboxitem and as to the further listboxitems.

Thanks

Arvind

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

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

发布评论

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

评论(1

十年不长 2024-08-03 04:56:59

您需要指定 TabNavigation 附加属性,以便 WPF 知道当用户按下 Tab 并且当前范围内没有更多控件可供 Tab 访问时要执行的操作:

<ListBox>
    <ListBox.ItemContainerStyle>
        <Style TargetType="ListBoxItem">
            <Setter Property="KeyboardNavigation.TabNavigation" Value="Continue"/>
        </Style>
    </ListBox.ItemContainerStyle>
</ListBox>

上面我指定了当没有更多控件时要执行的操作ListBoxItem 中要聚焦的项目,按 Tab 键应继续到下一个逻辑焦点容器(即下一个 ListBoxItem)。

You need to specify the TabNavigation attached property so that WPF knows what to do when the user presses tab and there are no more controls in the current scope to tab to:

<ListBox>
    <ListBox.ItemContainerStyle>
        <Style TargetType="ListBoxItem">
            <Setter Property="KeyboardNavigation.TabNavigation" Value="Continue"/>
        </Style>
    </ListBox.ItemContainerStyle>
</ListBox>

Above I specify that when there are no more items in the ListBoxItem on which to focus, pressing tab should continue to the next logical focus container (ie. the next ListBoxItem).

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