我的 WPF 应用程序中有一个TextBlock控件。当用户按住 shift 键并右键双击它时,我想显示一个“复活节彩蛋”。
我RoutedUiCommand在我的应用程序中添加了一个静态类,在该类中定义了所有命令。我为我的新命令添加了一个命令绑定:
<UserControl.CommandBindings>
<CommandBinding CanExecute="ShowDiagnostics_CanExecute" Command="cs:CarSystemCommands.ShowDiagnostics" Executed="ShowDiagnostics_Executed" />
</UserControl.CommandBindings>
当我创建 时RoutedUiCommand,我指定了 a MouseGestureofRightDoubleClick和 a ModifierKeyof Shift。到目前为止,一切都很好。
如何将命令与TextBlock?