My TreeViewItem.Items data template contains 2 text fields. When I press the Tab key in the first text box, the focus moves to the second text box. I want when I press Tab in the second text box - the focus happens in the first text box in the next TreeViewItem, and if the TreeViewItem does not have the next subitem, the focus will be on the first subitem of the next TreeViewItem. How to do it?
<TreeView Name="resultsTv"
ItemTemplate="{StaticResource excerciseResultDataTemplate}"
KeyboardNavigation.TabNavigation="Contained">
<TreeView.ItemContainerStyle>
<Style>
<Setter Property="TreeViewItem.IsExpanded" Value="True"/>
<Setter Property="KeyboardNavigation.TabNavigation" Value="Contained"></Setter>
</Style>
</TreeView.ItemContainerStyle>
</TreeView>
<HierarchicalDataTemplate x:Key="excerciseResultDataTemplate" ItemTemplate="{StaticResource setDataTemplate}" ItemsSource="{Binding Sets}">
<StackPanel Orientation="Horizontal" KeyboardNavigation.TabNavigation="Continue">
<Label Content="{Binding Name}"></Label>
</StackPanel>
</HierarchicalDataTemplate>
<DataTemplate x:Key="setDataTemplate">
<StackPanel Orientation="Horizontal" KeyboardNavigation.TabNavigation="Continue">
<TextBox Width="50" Text="{Binding Weight}"/>
<TextBox Width="50" Text="{Binding Repeats"/>
</StackPanel>
</DataTemplate>
source
share