Mvvm 组合框上按键的签名

Mvvm 组合框上按键的签名,mvvm,mvvm-light,blend,Mvvm,Mvvm Light,Blend,我在Visual Studio 2015中有一个WPF桌面应用程序,带有Blend扩展。我想为KeyDown事件在ComboBox中添加EventTrigger,但当我按下键(ESC)时,我得到以下错误:在类型为“ComboBox”的对象上找不到与预期签名匹配的名为“comboboxexitingstrategydown”的方法。 我的XMAL如下所示: <UserControl x:Class="MyserControl" xmlns="http://schemas.m

我在Visual Studio 2015中有一个WPF桌面应用程序,带有Blend扩展。我想为
KeyDown
事件在
ComboBox
中添加
EventTrigger
,但当我按下键(ESC)时,我得到以下错误:
在类型为“ComboBox”的对象上找不到与预期签名匹配的名为“comboboxexitingstrategydown”的方法。

我的XMAL如下所示:

<UserControl x:Class="MyserControl"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
         xmlns:se="http://schemas.microsoft.com/expression/2010/interactions"
         xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
<ComboBox x:Name="myComboBox" Grid.Row="9" Grid.Column="1" 
                    Style="{StaticResource MasterComboBox}"
                    ItemsSource="{Binding Path=InternalSourceItems, Mode=OneWay}"
                    SelectedItem="{Binding Path=InternalItem, UpdateSourceTrigger=PropertyChanged}"
                    Text="{Binding Path=InternalItemSelectedValue, UpdateSourceTrigger=PropertyChanged}"
                    SelectedValuePath="InternalValueItemDescription"
                    Margin="6,5,6,7">
              <i:Interaction.Triggers>
                <i:EventTrigger SourceObject="{Binding ElementName=myComboBox}" EventName="KeyDown">
                    <se:CallMethodAction MethodName="ComboBoxExitingStrategyKeyDown" 
                                         TargetObject="{Binding ElementName=myComboBox}"/>
                </i:EventTrigger>
              </i:Interaction.Triggers>
我尝试了一切,受保护的、私有的、公共的、没有参数的,只有一个,
RoutedEventArgs
,总能收到消息


我遗漏了什么吗?

TargetObject是包含该方法的对象

当前,它指向一个标准的组合框,该组合框不包含该方法

由于您的方法位于
MyserControl
的代码隐藏中,因此您应该将其指向该位置(通过添加一个与组合类似的名称)

public void ComboBoxExitingStrategyKeyDown(object sender, KeyEventArgs e)
{
   MessageBox.Show("Good");
}