I have to views which are overlapping. I'm using one view to display a popup. On this popup are 3 textboxes and two buttons. Inside this UserControl I've set the TabIndex properly. These views are in a ListModule. And these are loaded in two seperate UserControls of the MainModule.
But now when I'm navigating through this popup window with the tab key, after the second button the focus jumps out of the popup and back to the mainview. After that to the other view which is underlying the popup.
So basically every control that is focusable with the tab key is focused when tabbing through my application.
How can I limit the tabindex just to my specific popup view? (Not sure if some code is necessary here and which pieces. If yes, I'd provide some.)
I figured it out.
Based on this answer I played around with KeyboardNavigation.TabNavigation
in the UserControl
. Setting it to KeyboardNavigation.TabNavigation="Cycle"
holds the tabbing inside my UserControl
. And then put the TabIndex
of each control as usual.
Example:
<UserControl x:Class="ListModule.Views.AddNewItemView"
...
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="220" d:DesignWidth="320"
Background="#80FFB887"
KeyboardNavigation.TabNavigation="Cycle">