Wpf MouseRightButtonDown是否应与EventToCommand一起工作?

Wpf MouseRightButtonDown是否应与EventToCommand一起工作?,wpf,xaml,mvvm-light,eventtocommand,Wpf,Xaml,Mvvm Light,Eventtocommand,RightMouseDownEvent是否应与EventToCommand一起工作 我可以使用PreviewMouseRightUp和PreviewMouseRightDown绑定命令,但MouseRightButtonDown不做任何操作。我是否使用了错误的事件名称--有这么简单吗 在xaml中——我将两个事件绑定到同一个处理程序——只有一个有效(Preview…Up)。我依次对每一个进行注释,但只有预览才有效 想法?谢谢 <i:Interaction.Trigg

RightMouseDownEvent是否应与EventToCommand一起工作

我可以使用PreviewMouseRightUp和PreviewMouseRightDown绑定命令,但MouseRightButtonDown不做任何操作。我是否使用了错误的事件名称--有这么简单吗

在xaml中——我将两个事件绑定到同一个处理程序——只有一个有效(Preview…Up)。我依次对每一个进行注释,但只有预览才有效

想法?谢谢

            <i:Interaction.Triggers>
                <i:EventTrigger EventName="SelectionChanged">
                <cmd:EventToCommand Command="{Binding SetActivePaneCommand}"    CommandParameter="{Binding PaneOne}" PassEventArgsToCommand="False" />
                <cmd:EventToCommand Command="{Binding ListSelectionChangedCommand}" PassEventArgsToCommand="True" />
                </i:EventTrigger>
                <i:EventTrigger EventName="MouseRightButtonDown">
                    <cmd:EventToCommand Command="{Binding PreviewMouseRightButtonUpCommand}" PassEventArgsToCommand="True" />
                </i:EventTrigger>
                <i:EventTrigger EventName="PreviewMouseRightButtonUp">
                    <cmd:EventToCommand Command="{Binding PreviewMouseRightButtonUpCommand}" PassEventArgsToCommand="True" />
                </i:EventTrigger>
            </i:Interaction.Triggers>

一些控件处理MouseRightButtonDown事件,不允许它传播(例如MenuItem)。如果您正在调用代码隐藏方法而不是使用触发器,则可以轻松地测试这一点,并查看您是否会在该方法中达到突破点

在您的xaml中:

    MouseRightButtonDown="UIElement_OnMouseRightButtonDown"
在代码隐藏中:

    private void UIElement_OnMouseRightButtonDown(object sender, MouseButtonEventArgs e)
    { }

一旦我重新安装visual studio,我将尝试它--谢谢!