简体   繁体   English

设置Focusable = False导致TabItem在WPF中无法选择

[英]Set Focusable=False cause TabItem not selectable in wpf

In a window I have some TextBoxes and a TabControl and I want only textboxes be selectable. 在窗口中,我有一些TextBoxes和TabControl,并且我只希望选择文本框。 I set Focusable=False in TabItem . 我在TabItem设置Focusable=False But this made TabItem not selectable. 但这使TabItem无法选择。 How can I fix this problem. 我该如何解决此问题。

What I understood from your description is that you want to change focus using "Tab" key and you don't want TabControl to be selected. 从您的描述中我了解到,您想使用“ Tab”键更改焦点,并且不希望选择TabControl。

For that instead of setting Focusable=false, set IsTabStop="False". 为此,设置IsTabStop =“ False”而不是设置Focusable = false。

<TabItem IsTabStop="False" Header="Item 1">Content1</TabItem>

Setting IsTabStop="False" will ignore that control while changing focus using Tab key. 设置IsTabStop =“ False”将在使用Tab键更改焦点时忽略该控件。

Hope this will solve your issue. 希望这能解决您的问题。

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

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