预期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>发布于 2014-03-18 15:34:32
一些控件处理MouseRightButtonDown事件,不让它传播(例如,MenuItem)。如果您正在调用一个代码背后的方法,而不是使用触发器,那么您可以很容易地测试它,并查看在该方法中是否会达到一个断点。
在xaml中:
MouseRightButtonDown="UIElement_OnMouseRightButtonDown"在后面的代码中:
private void UIElement_OnMouseRightButtonDown(object sender, MouseButtonEventArgs e)
{ }https://stackoverflow.com/questions/22483662
复制相似问题