简体   繁体   English

WPF中的选项卡控件

[英]Tab control in WPF

I created a new WPF application with a TextBox, ListBox, RichTextBox and a Menu. 我使用文本框,列表框,RichTextBox和菜单创建了一个新的WPF应用程序。 I want to create a tab circle between first 3 controls. 我想在前三个控件之间创建一个制表符圈。 When RichTextBox is focused and user presses Tab (KeyDown event), I set focus to my TextBox. 当RichTextBox处于焦点状态并且用户按下Tab(KeyDown事件)时,我将焦点设置为TextBox。 But when I run program and press Tab, Menu is focused instead of TextBox. 但是,当我运行程序并按Tab时,菜单将集中显示,而不是TextBox。

I tried with a new C# application but didn't get this error. 我尝试使用新的C#应用​​程序,但未收到此错误。 Somehow this only happens in WPF. 不知何故,这仅在WPF中发生。

You can set the TabIndex on every control. 您可以在每个控件上设置TabIndex That would allow you to make your own order of fields. 这将使您可以自己确定字段的顺序。

If you want to exclude your menu from the tab stops, use this on it: 如果要从制表位中排除菜单,请在其上使用此菜单:

KeyboardNavigation.IsTabStop="False"

Note: there is no need to handle the events yourself. 注意:不需要自己处理事件。 WPF will handle the Tab key. WPF将处理Tab键。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM