1
votes

I created a new WPF application with a TextBox, ListBox, RichTextBox and a Menu. I want to create a tab circle between first 3 controls. When RichTextBox is focused and user presses Tab (KeyDown event), I set focus to my TextBox. But when I run program and press Tab, Menu is focused instead of TextBox.

I tried with a new C# application but didn't get this error. Somehow this only happens in WPF.

1

1 Answers

2
votes

You can set the TabIndex on every control. That would allow you to make your own order of fields.

If you want to exclude your menu from the tab stops, use this on it:

KeyboardNavigation.IsTabStop="False"

Note: there is no need to handle the events yourself. WPF will handle the Tab key.