views:

439

answers:

2
Control.TabIndex

Only allows me to overide the Tab order of controls in a given container.

Is there a way to specify this across all the controls in, for example a UserControl, regardless of the contains used to arrange the controls.

Cheers,

Jan

A: 

I'm not sure that there is a particularly good way of doing what you are asking, but check out Changing WPF focus in code.

That uses KeyboardNavigation.TabNavigation to set how the various containers take and give up the Focus on tabbing, and also sets the TabIndex properties for each control. Look at the example code with the TabNavigation set to Continue.

IF your tabbing problems are simple, you should be able to find a solution here, if they are complex of need to be generalised, then it might take some more work.

James Osborn
A: 

This kind of focus handling is horrible in WPF. The best approch is to make a lot of controls not accept focus with Focusable="False".

The TabNavigation answer would solve the tab key however the arrow keys will not work like you want.

Steven