I have a view in WPF that I'm fighting for the correct tab settings. I have three text fields (allows you to call them Text1, Text2 and Text3) and two custom controls, each of which has several other text fields and different controls (allows you to call them Custom1 and Custom2).
The layout is such that the tab stream should go Text1, Text2, Custom1, Custom2, Text3. I set the TabIndex property for each control to match this order and verified that they are all set to IsTabStop.
The problem is that the actual tab stream goes Text1, Text2, Text3, and then Custom1, Custom2, and I cannot understand why. When it goes to user controls, it correctly steps over each control in them, as I expected. I just can't understand why it goes to the third text box before it goes to the first custom control.
I tried everything I can think of, including making sure that all xaml elements are arranged in tab order, but nothing helps.
I suspect that it is sorting through all its main controls before paying attention to any user controls, but I'm not in ideas. Any help would be great.
EDIT: Here is my xaml:
<Grid> <GroupBox x:Name="_groupBox" BorderBrush="Transparent" BorderThickness="0"> <Grid x:Name="_card"> <Label Content="A:" Height="28" HorizontalAlignment="Left" Margin="5,3,0,0" Name="_labelA" VerticalAlignment="Top" /> <Label Content="B:" Height="28" HorizontalAlignment="Left" Margin="5,25,0,0" Name="_labelB" VerticalAlignment="Top" /> <TextBox Name="_a" Height="20" HorizontalAlignment="Left" Text="{Binding AText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" IsEnabled="{Binding AEnabled}" Margin="94,5,0,0" VerticalAlignment="Top" LostFocus="InputNameLeave" Width="221" TabIndex="0" /> <TextBox Name="_b" Height="20" HorizontalAlignment="Left" Margin="94,26,0,0" Text="{Binding BText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Top" Width="102" TabIndex="1" /> <my:CustomControlA HorizontalAlignment="Left" Margin="-6,55,0,0" x:Name="_custom1" VerticalAlignment="Top" TabIndex="2" IsTabStop="True" /> <my:CustomControlB HorizontalAlignment="Left" Margin="334,0,0,0" x:Name="_custom2" VerticalAlignment="Top" Width="320" TabIndex="3" IsTabStop="True" /> <Label Content="C:" Height="28" HorizontalAlignment="Left" Margin="342,59,0,0" Name="_labelC" VerticalAlignment="Top" /> <TextBox Name="_c" Height="20" HorizontalAlignment="Left" Margin="417,60,0,0" Text="{Binding CText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" IsEnabled="{Binding CEnabled}" VerticalAlignment="Top" Width="154" TabIndex="4" /> </Grid> </GroupBox> </Grid>