关于WPF 的快捷键

Posted on 2013-08-09 14:34  xiaomaogong  阅读(408)  评论(0编辑  收藏  举报

首先可以以在任意的UIElement中的InputBindings 添加KeyBinding或者其他的mouseBinding, 如下

<UserControl.InputBindings>
        <KeyBinding Command="{Binding NavCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}}" Key="D1" Modifiers="Control" CommandParameter="{Binding ElementName=curveSummaryGroup}"/>
        <KeyBinding Command="{Binding NavCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}}" Key="D2" Modifiers="Control" CommandParameter="{Binding ElementName=curveHistoryGroup}"/>
    </UserControl.InputBindings>

其中

Gesture = key + Modifiers,可以只用genstrure或者key + Modifiers,但不要一起用会造成冲突

 

 

Copyright © 2024 xiaomaogong
Powered by .NET 9.0 on Kubernetes