I have a strange behavior: I have a MainWindow containing text fields and (simple) usercontrols (text field and button), but I only split this into a text field for debugging purposes.
When I use text fields and custom elements WITHOUT setting the TabIndex property, the cursor moves through the controls in the correct order (in the order that the controls were added to the window)
When I use text fields and WITH user controls by setting the TabIndex property, the cursor moves through the controls in the wrong order (first all user controls and then all text fields), this is also true when the TabIndex value is set to the value corresponding to the order in which the control was added
Here is my usercontrol
<UserControl x:Class="SmallControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" > <TextBox x:Name="txTEXT" Text="{Binding Text}" /> </UserControl>
The following Mainwindow xaml file results in order 000000,111111,222222,333333, thats ok
<GroupBox Header="Small,Textbox,Small,TextBox without TabIndex"> <UniformGrid Columns="4"> <local:SmallControl Text="000000" /> <TextBox Text="111111" /> <local:SmallControl Text="222222" /> <TextBox Text="333333" /> </UniformGrid> </GroupBox>
The following Mainwindow xaml file leads to the order 000000,222222,111111,333333, thats NOT ok
<GroupBox Header="Small,Textbox,Small,TextBox with TabIndex"> <UniformGrid Columns="4"> <local:SmallControl TabIndex="0" Text="000000" /> <TextBox TabIndex="1" Text="111111" /> <local:SmallControl TabIndex="2" Text="222222" /> <TextBox TabIndex="3" Text="333333" /> </UniformGrid> </GroupBox>
Is there a way to use TabIndex without having to add controls in the "correct" order in xaml?
Relations Klaus