Keyboard shortcuts in WPF MVVM?

后端 未结 1 1649
借酒劲吻你
借酒劲吻你 2020-12-28 20:34

I have WPF application that follow MVVM pattern. I need to implement keyboard shortcuts. These shortcut have to contol WebBrowser control behaviour. I defined first custom c

相关标签:
1条回答
  • 2020-12-28 21:08
    <Window.InputBindings>
      <KeyBinding Command="{Binding MyCommand, Source=viewModel...}"
                  CommandParameter="{Binding,ElementName=browserControl,Mode=Self}"
                  Gesture="CTRL+R" />
    </Window.InputBindings>
    

    You can bind command property to View Model's command.

    0 讨论(0)
提交回复
热议问题