■No69264 (くぅ さん) に返信 > 調べてみましたがヒントが見つかっていません。 > お分かりの方いらっしゃいましたら、よろしくお願いいたします。 ※当方、WPFは今回初めて使い、WPFおよびKeyBinding関連の処理等を 理解せずに作成したので参考まで。 以下のページを参考にし、 以下のソースコードを作成し、実行したところ、 5種類のキー操作に対し、正常に動作しました。 【環境】 OS:Windows8.1 VisualStudio2008StandardEdition 【参考サイト】 http://d.hatena.ne.jp/hilapon/20110324/1300937847 【Window1.xaml】 <Window x:Class="WpfApplication1.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300"> <Window.CommandBindings> <CommandBinding Command="Close" Executed="Execute1" /> </Window.CommandBindings> <Window.InputBindings> <KeyBinding Gesture="Ctrl+C" Command="Close" /> <KeyBinding Gesture="Delete" Command="Close" /> <KeyBinding Gesture="Right" Command="Close" /> <KeyBinding Gesture="Ctrl+Right" Command="Close" /> <KeyBinding Gesture="Alt+Shift+Right" Command="Close" /> </Window.InputBindings> <Grid> </Grid> </Window> 【Window1.xaml.cs】 using System; using System.Windows; namespace WpfApplication1 { public partial class Window1 : Window { public Window1() { InitializeComponent(); } private void Execute1(object sender, RoutedEventArgs e) { MessageBox.Show("Execute1が実行されました。"); } } } ===ここまで===== 環境が違うので微妙ではありますが、 提示している箇所は同じにして動作させてうまくいったので、 提示していない箇所に問題があるのではないでしょうか? もう少し、広くソースコードを提示してはどうでしょうか? また、ミニマムコードを作成し、検証してみてはいかがでしょうか?
- Child Tree -