In WPF, how does one jump out of the tab loop from the toolbar?
Zhou yinhui
In WPF. When the tab key is used continuously in the toolbar, it will loop with it. You can run the following Code And found the problem:< Window Xmlns = "Http://schemas.microsoft.com/winfx/2006/xaml/presentation" Xmlns: SYS = "CLR-namespace: system; Assembly = mscorlib" Xmlns: x = "Http://schemas.microsoft.com/winfx/2006/xaml" >
< Dockpanel >
< Toolbar Dockpanel. Dock = "TOP" >
< Button Content = "B"
Command = "Editingcommands. togglebold" />
< Button Content = "U"
Command = "Editingcommands. toggleunderline" />
< Button Content = "I"
Command = "Editingcommands. toggleitalic" />
</ Toolbar >
< RichTextBox />
</ Dockpanel >
</ Window >
How can we jump out of this loop? It's easy to set the tabnavigation attribute of tabbar to continue :)
Run the following code and you will find that the tab key focus can jump from the button "I" to RichTextBox.
< Window Xmlns = "Http://schemas.microsoft.com/winfx/2006/xaml/presentation" Xmlns: SYS = "CLR-namespace: system; Assembly = mscorlib" Xmlns: x = "Http://schemas.microsoft.com/winfx/2006/xaml" >
< Dockpanel >
< Toolbar Dockpanel. Dock = "TOP"
Keyboardnavigation. tabnavigation = "Continue" >
< Button Content = "B"
Command = "Editingcommands. togglebold" />
< Button Content = "U"
Command = "Editingcommands. toggleunderline" />
< Button Content = "I"
Command = "Editingcommands. toggleitalic" />
</ Toolbar >
< RichTextBox />
</ Dockpanel >
</ Window >