I’m writing a really simple name / value editor control where the value is editable – label on left and property text box on right. Control works fine except that when the user hits TAB when inside one of the “value” text boxes on the right, the focus shifts away from my control to the next control in the hiearchy. I want the focus to go to the next text box in my control so users can just tab between property text boxes. I tried setting “IsTabStop” to true but doesn’t seem to work.
Here’s my data template:
<DataTemplate x:Key="myDataTemplate">
<StackPanel>
<TextBlock Text="{Binding Name}" />
<TextBox IsTabStop="True" Text="{Binding Value, Mode=TwoWay}" />
</StackPanel>
</DataTemplate>
Are you using your datatemplate as an item template for the items container type control, e.g. a ListBox? Check out a KeyboardNavigation class, you might want to setup its TabNavigation property to “Continue” or “Cycle” for your items container, smth like this:
when focus is changed using the tab key within the ListBox, focus will move from each element and when the last element is reached focus will return to the first element for “Cycle” or move to next focusable control on the form if “Continue” is set up.
hope this helps, regards
edit0: make text box receive focus right after listbox item gets selected