简体   繁体   English

wpf菜单标签停止奇怪的行为

[英]wpf menu tab stop strange behaviour

I've just been cleaning up my program and I was checking how the tabs worked when I came across this very strange behaviour. 我刚刚清理了我的程序,当我遇到这种非常奇怪的行为时,我正在检查标签的工作方式。 My Main menu items were included in the tab order. 我的主菜单项包含在Tab键顺序中。 Thinking that was strange I set their IsTabStop property to false, and ran it again. 认为这很奇怪我将他们的IsTabStop属性设置为false,然后再次运行它。

They were no longer in my tab order but when I pressed ALT to activate the menu I could no longer use the arrow keys to navigate between the items. 它们不再是我的Tab键顺序,但是当我按下ALT激活菜单时,我再也无法使用箭头键在项目之间导航。

Is there a way around this and make the menu act like a normal old school menu? 有没有办法解决这个问题,让菜单像普通的老式菜单一样?

Here's how to exclude your menus from the tab order using KeyboardNavigation.TabNavigation : 以下是使用KeyboardNavigation.TabNavigation从Tab键顺序中排除菜单的方法:

<DockPanel>
    <Menu DockPanel.Dock="Top">
        <MenuItem Header="_File">
            <MenuItem Header="Open"/>
            <MenuItem Header="E_xit"/>
        </MenuItem>
    </Menu>
    <StackPanel KeyboardNavigation.TabNavigation="Cycle">
        <TextBox Text=""/>
        <TextBox Text=""/>
    </StackPanel>
</DockPanel>

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

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