I have a Problem with setting up the TabIndexes
correctly. I have a Usercontrol
with a GroupBox
.
<GroupBox KeyboardNavigation.TabNavigation="Local" TabIndex="0">
<Grid KeyboardNavigation.TabNavigation="Continue">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" Grid.Row="0" KeyboardNavigation.TabNavigation="Continue">
<my:uscZeitraum TabIndex="1" />
<Label />
<ComboBox TabIndex="2" />
<Label />
<ComboBox TabIndex="3" HorizontalAlignment="Right" VerticalAlignment="Top" Width="88" />
<Label />
<ComboBox TabIndex="4" HorizontalAlignment="Right" VerticalAlignment="Top" Width="67" />
<Label />
<ComboBox TabIndex="5" IsEditable="True" GotFocus="cboVorgang_GotFocus" HorizontalAlignment="Right" VerticalAlignment="Top" Width="93" />
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Row="1" KeyboardNavigation.TabNavigation="Continue">
<Label />
<ComboBox TabIndex="6" HorizontalAlignment="Left" Width="192" Height="23" VerticalAlignment="Bottom" />
<Label />
<ComboBox TabIndex="7" Height="23" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="225" />
<Label />
<ComboBox IsEditable="True" TabIndex="8" HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="67" />
<Label />
<ComboBox IsEditable="True" TabIndex="9" Width="80" />
</StackPanel>
</Grid>
</GroupBox>
The first Control
is also a UserControl
but this works like I want to. But if I reach the third ComboBox
in the first StackPanel
it just starts at the beginning again. It doesn't focus the fourth ComboBox
and also doesn't jump into the second Row
/Stackpanel
. What could that be?
There must be some code in cboVorgang_GotFocus which is doing that. The code written there would be changing the tab order.