IsTabStop=“False” has no effect on my WPF app

亡梦爱人 提交于 2019-12-01 15:21:33

问题


I'm having a really hard time with something that should be trivial. I just want to remove a few buttons from the tab order on a UserControl. I've tried adding IsTabStop="False" and KeyboardNavigation.IsTabStop="False" attributes to their xaml declarations, as well as setting myButton.IsTabStop = false; in the Loaded event handler for the UserControl. None of these additions had any effect, I could still tab to the controls I did this for.

Setting the TabIndex in the xaml works fine. The UserControl is being displayed in a WPFElementHost if that might make a difference. The other thought I had was that I might need to specify the TabIndex for all the other controls, but I haven't read that anywhere and I'd prefer to not state that explicitly if possible. Does anyone have a guess as to what might be going wrong?


回答1:


Try setting KeyboardNavigation.TabNavigation ="None" in the parent control.




回答2:


You need also employ KeyboardNavigation.TabNavigation ="Continue" for the parent controls, and

"Focusable=False" 


来源:https://stackoverflow.com/questions/5078937/istabstop-false-has-no-effect-on-my-wpf-app

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!