Question

I have a number of UserControl that each contain a number of StackPanels. The problem I have is that each StackPanel seems to think that I'm interested in tabbing to it before I tab to the contents of the StackPanel. If I want to tab from a control that exists in StackPanel_A to a control that exists in StackPanel_B I need to hit tab at least twice to tab from the first control to StackPanel_B, to the second control.

I can turn off the TabStop by specifying, e.g.

<StackPanel KeyboardNavigation.IsTabStop="False" />

but considering how many StackPanel elements I have it's both tedious and messy.

Is there a way for me to do this in a single global place?

Was it helpful?

Solution

You might be able to achieve this by using a style in a global scope (e.g. your App.xaml file):

<Application.Resources>
    <Style TargetType="{x:Type StackPanel}">
        <Setter Property="KeyboardNavigation.IsTabStop" Value="False" />
    </Style>
</Application.Resources>

Then this way any StackPanel in your application won't be a tab stop.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top