【发布时间】:2013-04-24 20:41:39
【问题描述】:
我的 WPF 应用程序中有一个 TextBlock 控件。当用户按住 shift 键并右键双击它时,我想显示一个“复活节彩蛋”。
我已将RoutedUiCommand 添加到我定义了所有命令的应用程序的静态类中。我为我的新命令添加了一个命令绑定:
<UserControl.CommandBindings>
<CommandBinding CanExecute="ShowDiagnostics_CanExecute" Command="cs:CarSystemCommands.ShowDiagnostics" Executed="ShowDiagnostics_Executed" />
</UserControl.CommandBindings>
当我创建RoutedUiCommand 时,我指定了RightDoubleClick 的MouseGesture 和ModifierKey 的Shift。到现在为止还挺好。
如何将命令与TextBlock 关联?
【问题讨论】:
标签: wpf dialog command mouseevent routed-commands