Question

I have a view with a menu:

<Menu IsTabStop="False">
    <MenuItem
        Header="_File"
        IsTabStop="True">
        <MenuItem
            Header="New / Start Over"
            IsTabStop="True"
            InputGestureText="Ctrl+N"
            Command="{x:Static common:Commands.StartOverCommand}" />
        <Separator
            IsTabStop="False" />
        <MenuItem
            Header="Log Out"
            IsTabStop="True"
            InputGestureText="F12"
            Click="LogoutMenuItem_Click" />
        <MenuItem
            Header="E_xit"
            IsTabStop="True"
            InputGestureText="Alt+F4"
            Click="ExitMenuItem_Click" />
    </MenuItem>
    <MenuItem
        Header="_Edit"
        IsTabStop="True">
        <MenuItem
            Header="Undo Edit Field"
            IsTabStop="True"
            InputGestureText="Ctrl+Z"
            Click="_undoMenuItem_Click" />
        <MenuItem
            Header="Redo Edit Field"
            IsTabStop="True"
            InputGestureText="Ctrl+Y"
            Click="_redoMenuItem_Click" />
    </MenuItem>
    <MenuItem
        Header="_Tools"
        IsTabStop="True">
        <MenuItem
            Header="Comments"
            IsTabStop="True"
            InputGestureText="Ctrl+M"
            Click="_commentsMenuItem_Click" />
    </MenuItem>
</Menu>

I would like to be able to navigate through the menus (File, Edit, Tools) by using the right and left arrow keys, which I was able to accomplish by making these MenuItems IsTabStop="True". But since I did this I am able to tab to the menu as I cycle through the other valid fields on a page. When I use Alt+F to put focus on the File menu I want to be able to cycle through the 3 menus with the arrow keys, but I don't want to be able to tab to these menus from the page. How would I accomplish this?

Was it helpful?

Solution

Use the KeyboardNavigation.TabNavigation Attached Property with KeyboardNavigationMode.None on menu.

<Menu KeyboardNavigation.TabNavigation="None">
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top