2016-01-21 46 views
1

我需要通過Interaction.Triggers PassEventArgsToCommand與CommandParameter沿 - WPF C#如何通過PassEventArgsToCommand隨着CommandParameter在Interaction.Triggers

我的XAML源代碼:

<i:Interaction.Triggers> 
    <i:EventTrigger EventName="MouseDoubleClick"> 
     <commandHelper:EventToCommand PassEventArgsToCommand="True" Command="{Binding OpenDetailsCommandByLeftMouseBtn}" CommandParameter="Provider"/> 
    </i:EventTrigger> 
</i:Interaction.Triggers> 

對我來說,它會拋出一個異常從'System.String'無效轉換爲'System.Windows.Input.MouseButtonEventArgs'

回答

1

您可以使用InvokeCommandAction。

<i:Interaction.Triggers> 
       <i:EventTrigger EventName="MouseDoubleClick"> 
        <i:InvokeCommandAction Command="{Binding ButtonClickCommand}" CommandParameter="parameter"/> 
       </i:EventTrigger> 
      </i:Interaction.Triggers> 
+0

感謝您的回覆,它可能會通過EventArgs? –