【问题标题】:How to Pass PassEventArgsToCommand along with CommandParameter in Interaction.Triggers如何在 Interaction.Triggers 中传递 PassEventArgsToCommand 和 CommandParameter
【发布时间】:2016-04-27 10:50:20
【问题描述】:

我需要在 Interaction.Triggers - WPF C#

中传递 PassEventArgsToCommandCommandParameter

我的 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”的无效转换

【问题讨论】:

    标签: c# wpf command mouseevent eventtrigger


    【解决方案1】:

    您可以使用 InvokeCommandAction。

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

    【讨论】:

    • 感谢您的回复,可能会通过EventArgs?
    猜你喜欢
    • 2012-12-14
    • 1970-01-01
    • 2012-05-13
    • 2022-01-26
    • 1970-01-01
    • 2012-09-04
    • 2016-11-24
    • 2017-08-06
    • 1970-01-01
    相关资源
    最近更新 更多