Sam Black
Sam Black

Reputation: 371

Tab control in WPF

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.

Upvotes: 1

Views: 150

Answers (1)

Patrick Hofman
Patrick Hofman

Reputation: 156978

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.

Upvotes: 2

Related Questions