Can I configure a WPF shortcut to focus the next item in tab order when I press the access key?

In WinForms, the control focused on pressing the label access key is determined by the tab order. Since in any case you need to get the right to the tab, the target shortcuts were mostly “effortless” in WinForms.

WPF requires a bit more effort: each Label Target must be carefully identified by name. It can’t even be clicked on to preview the form (at least not in Visual Studio 2010 - I don’t know about Expression).

Is it possible to simplify or even completely automate, as it was in WinForms?

+4
source share
1 answer

Source: MS Forum

Looks like this time they missed the release bus. Therefore, you need to manually set the properties of the interface elements.

Update: I seem confused about your exact question.

  • If it comes to adjusting the keyboard navigation order for the entire form quickly, then the KeyboardNavigation class is what you need. There is no design support yet.
  • If this is a label binding with the corresponding control, so pressing the accelerator key moves the focus to the control, then you need to manually set the Target Label property. Even in Winforms, I think you had to go and change each label to indicate the exact character / accelerator. (_ And or the symbol before the mnemonic)
+1
source

Source: https://habr.com/ru/post/1388078/


All Articles