WPF: The toolbar is a keyboard trap

Multi tool use


WPF: The toolbar is a keyboard trap
I have the following XAML code:
<ToolBarTray DockPanel.Dock="Top">
<ToolBar VerticalAlignment="Top">
<ComboBox x:Name="ComboboxFontname" ToolTip="Auswahlliste um Schriftart festzulegen" ItemsSource="{x:Static Fonts.SystemFontFamilies}" SelectedIndex="0" Width="200" GotFocus="ComboBox_GotFocus" LostFocus="ComboBox_LostFocus"/>
<ComboBox x:Name="ComboboxFontsize" ToolTip="Auswahlliste um Schriftgröße festzulegen" SelectedIndex="0" Width="45" GotFocus="ComboBox_GotFocus" LostFocus="ComboBox_LostFocus">
<ComboBoxItem Content="12"/>
<ComboBoxItem Content="14"/>
<ComboBoxItem Content="16"/>
<ComboBoxItem Content="18"/>
<ComboBoxItem Content="20"/>
<ComboBoxItem Content="22"/>
<ComboBoxItem Content="24"/>
<ComboBoxItem Content="26"/>
<ComboBoxItem Content="28"/>
</ComboBox>
<Label Name="lblSuchen" Content="_Suchen" Target="{Binding ElementName=edtSuchen}"/>
<TextBox Name="edtSuchen" Width="150" ToolTip="Bitte Suchbegriff eingeben. Suche Starten mit der Enter-Taste" KeyDown="edtSuchen_KeyPress" GotFocus="TextBox_GotFocus" LostFocus="TextBox_LostFocus"/>
<Label Name="lblErsetzen" Content="_Ersetzen" Target="{Binding ElementName=edtErsetzen}"/>
<TextBox Name="edtErsetzen" Width="150" ToolTip="Bitte Begriff eingeben, durch den der Suchbegriff ersetzt werden soll. Ersetzen Starten mit der Enter-Taste" KeyDown="edtErsetzen_KeyPress" GotFocus="TextBox_GotFocus" LostFocus="TextBox_LostFocus" IsTabStop="True" TabIndex="3" />
<Grid>
<CheckBox Name="ChkBarrierefrei" Content="Editor ba_rrierefrei" Margin="10" Click="ChkBarrierefrei_CheckedChanged" IsTabStop="True" TabIndex="4"/>
</Grid>
</ToolBar>
</ToolBarTray>
<TextBox Name="TBXEditor" DockPanel.Dock="Top" MinWidth="525" MinHeight="240" AcceptsReturn="True" FontSize="{Binding Path=SelectedValue.Content, ElementName=ComboboxFontsize}" FontFamily="{Binding Path=SelectedValue, ElementName=ComboboxFontname}" IsTabStop="True" TabIndex="5" GotFocus="TBXEditorBox_GotFocus" LostFocus="TBXEditorBox_LostFocus">
</TextBox>
If the checkbox "ChkBarrierefrei" has the focus and I press the tabulator key, then the textbox "TBXEditor" does not get the focus, but the comboxbox "ComboboxFontname". This means I can not get out of the toolbar with the Tab key. What can I do against it?
1 Answer
1
Try setting the ToolBarTray and/or ToolBar KeyboardNavigation.TabNavigation="Continue"
. The TextBox control should get focus now after the last CheckBox
when you press the tab key.
KeyboardNavigation.TabNavigation="Continue"
CheckBox
Here's the MS link regarding the different enum values - KeyboardNavigationMode Enum
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.