私はWPFを使用しています。WPFアプリケーションのキーボードショートカットを作成したいと思います。以下のように作成しました。「 open 」の最初のコマンドバインディングタグは機能しており、exitのコマンドバインディングは機能していません。理由はわかりません。
<Window.CommandBindings>
<CommandBinding Command="Open" Executed="CommandBinding_Executed"/>
<CommandBinding Command="Exit" Executed="CommandBinding_Executed_1" />
</Window.CommandBindings>
<Window.InputBindings>
<KeyBinding Command="Open" Key="O" Modifiers="control" />
<KeyBinding Command="Exit" Key="E" Modifiers="control"/>
</Window.InputBindings>
上記のコードでは、次のエラーが発生しています。
属性「Command」の文字列「Exit」をタイプ「System.Windows.Input.ICommand」のオブジェクトに変換できません。CommandConverterはSystem.Stringから変換できません。マークアップファイル'WpfApplication2;component/window1.xaml'のオブジェクト'System.Windows.Input.CommandBinding'でエラーが発生しました。行80の位置25。