【发布时间】:2016-04-07 05:37:44
【问题描述】:
已经使用了如下的事件触发器,
<i:Interaction.Triggers>
<local:EventTriggerExt EventName="MouseLeftButtonDown">
<i:InvokeCommandAction Command="{Binding BuyItemCommand}" />
</local:EventTriggerExt>
<local:EventTriggerExt EventName="MouseRightButtonDown">
<i:InvokeCommandAction Command="{Binding SellItemCommand}" />
</local:EventTriggerExt>
</i:Interaction.Triggers>
代码背后:
class EventTriggerExt :System.Windows.Interactivity.EventTrigger
{
protected override void OnEvent(EventArgs eventArgs)
{
if(this.AssociatedObject is SfDataGrid && eventArgs is MouseButtonEventArgs)
{
var args = eventArgs as MouseButtonEventArgs;
}
base.OnEvent(eventArgs);
}
}
当我单击 DataGrid 单元格时,MouseRightButtonDown 事件与 SellItemCommand 配合得很好。但是 MouseLeftButtonDown 事件不起作用,LeftClick 事件也不起作用。希望任何人都遇到过这个问题并提出解决方案。
有什么想法吗?
问候, 斯米尔蒂
【问题讨论】: