WPF/xaml 中视图元素之间的 Tab 键切换
我正在尝试在 xaml 中的当前 WPF 项目上设置选项卡键盘控制选项。
本质上,我在一个视图中、另一个视图中、另一个视图中都有一个 TextBox 元素。无论如何,当按下键盘上的选项卡时,它开始循环浏览容器视图的各种元素,并最终转到我需要它去的文本框。我希望让它从这个文本框开始,并且我希望有一种简单的方法来实现这一点。
我尝试设置 KeyboardBinding.TabNavigation 设置以及 TabIndex 选项,但这些并没有按照我想要的方式工作。
据我所知,到目前为止,我担心我可能需要转到容器视图并单独在每个 ItemControl 上设置绑定属性,然后它将使用每个子元素的本地选项卡设置。
不管怎样,我希望有一个更有效的方法。
提前致谢。
I'm trying to setup the tab keyboard control options on my current WPF project in xaml.
Essentially, I've got a TextBox element within a view, within another view, within another view. Anyway, when pushing tab on the keyboard, it starts cycling through various elements of the container views and eventually goes to the TextBox I need it to go to. I'm hoping to make it start at this text box, and I'm hoping there is an easy way to accomplish this.
I tried setting KeyboardBinding.TabNavigation settings, as well as TabIndex options, but these aren't working in the way I'm trying to get.
From what I understand so far, I'm worried I may need to go to the container views and set up a binding property on each of the ItemControls individually and then it would use the local tabbing settings for each child element.
Anyway, I'm hoping there is a more efficient way.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在您的根容器(在我的示例中它是一个用户控件)中设置焦点,如下所示:
At your root container (in my example it's a user control) set the focus like this: