我怎样才能防止切换到用户控件? [英] How can I prevent tabbing to a UserControl?
问题描述
我有一个自定义的Popup覆盖了我的屏幕的一部分。当它打开时,我想要禁止在它后面的用户控件。我不想使用 IsEnabled
属性,因为我不想使所有控件变灰。
I have a custom Popup that overlays part of my screen. When it is open, I want to disable tabbing into the UserControl behind it. I do not want to use the IsEnabled
property because I do not want to gray out all the controls.
是还有另一个属性是做同样的事情? IsTabStop
只会阻止选项卡停留在UserControl本身,而不是它的子选项,并且 IsFocusable
不是有效的属性为一个UserControl。
Is there another property that does the same thing? IsTabStop
only prevents the tab from stopping on the UserControl itself, not it's children, and IsFocusable
isn't a valid property for a UserControl.
推荐答案
使用 KeyboardNavigation.TabNavigation附加属性与 KeyboardNavigationMode.None 。
Use the KeyboardNavigation.TabNavigation Attached Property with KeyboardNavigationMode.None on your container control.
KeyboardNavigation.TabNavigation="None"
这篇关于我怎样才能防止切换到用户控件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!