2011-04-14 75 views

回答

3

Key.OemOpenBrackets & Key.OemCloseBrackets

只是這個測試吧:帶或不帶修飾

<Window.CommandBindings> 
    <CommandBinding Command="Help" Executed="Help_Executed" CanExecute="Help_CanExecute"/> 
</Window.CommandBindings> 
<Window.InputBindings> 
    <KeyBinding Key="OemOpenBrackets" Command="Help" Modifiers="Control"/> 
</Window.InputBindings> 
private void Help_Executed(object sender, ExecutedRoutedEventArgs e) 
{ 
    MessageBox.Show("!"); 
} 

private void Help_CanExecute(object sender, CanExecuteRoutedEventArgs e) 
{ 
    e.CanExecute = true; 
} 

工作對我來說,可能是控制你聲明的約束力是失焦。另一個原因可能是鍵盤佈局,但我不知道鍵是如何解決的。

+0

這看起來好像會起作用,但它沒有。 – anthony 2011-04-14 23:00:47

+0

奇怪的,我會再看一遍...... – 2011-04-14 23:03:26

+0

再次測試它,它的工作原理,看看我的補充。 – 2011-04-14 23:07:07