Currently, I have a context menu with submenus containing checkboxes. I have implemented it in a manner similar to below:
<ContextMenu>
<MenuItem Header="Submenu1">
<MenuItem Header="item1.1" IsTabStop="False">
<CheckBox Content="item1.1 checkbox"/>
</MenuItem>
<MenuItem Header="item1.2" IsTabStop="False">
<CheckBox Content="item1.2 checkbox"/>
</MenuItem>
<MenuItem Header="item1.3" IsTabStop="False">
<CheckBox Content="item1.3 checkbox"/>
</MenuItem>
</MenuItem>
<MenuItem Header="Submenu2">
<MenuItem Header="item2.1" IsTabStop="False">
<CheckBox Content="item2.1 checkbox"/>
</MenuItem>
<MenuItem Header="item2.2" IsTabStop="False">
<CheckBox Content="item2.2 checkbox"/>
</MenuItem>
<MenuItem Header="item2.3" IsTabStop="False">
<CheckBox Content="item2.3 checkbox"/>
</MenuItem>
</MenuItem>
</ContextMenu>
I have set the IsTabStop
property of each MenuItem
to false to fix an earlier bug I found wherein the focus gets stuck on a single menu item (when TAB key is used). However, what happens now is when Submenu1
is open and I try to move focus through the different menu items using the Up or Down arrow key, the submenu closes immediately and highlights the Submenu2
item in the context menu.
I would like to be able to use TAB or arrow keys in moving the focus through the menu items in each submenu. Thank you in advanced for the help.