How to disable focus changes by arrow keys

后端 未结 3 699
栀梦
栀梦 2021-02-14 22:28

I have a WPF window with a few controls (buttons, groupboxes, etc) and one big Viewport3D within a Border.

The viewport shows a 3D scene and I

3条回答
  •  长发绾君心
    2021-02-14 23:04

    If we want to be able to tab between controls but not arrow key through the same set of controls once they are in keyboard navigation mode it should be that we can set KeyboardNavigation.DirectionalNavigation="None" for the container (in this case the window).

    However it seems there is some bug stopping that solution from working.

    The workaround of setting KeyboardNavigation.DirectionalNavigation="Once" works though.

    • The only caveat I've noticed so far is that upon pressing an arrow key the FocusVisualStyle is reloaded for the currently selected element.

提交回复
热议问题