Moving to next control on Enter keypress in WPF

前端 未结 7 2065
梦毁少年i
梦毁少年i 2020-11-30 23:20

I want to move to the next control when I press the Enter key instead of the Tab key in a WPF MVVM application. How can I achieve this?

7条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-30 23:40

    First that occured to add trigger to each element that will invoke when PreviewKeyDown fires. Also add Dependency property and bind FrameworkElement that you wont to bring focus at. Within trigger provide setting Focus to binded element.

提交回复
热议问题