命令
1.添加引用
- Microsoft.Expression.Interactions.dll
-System.Windows.Interactivity
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
2.命令分类
<Button Content="Submit Method" Width="180">
<i:Interaction.Triggers>
<!--传递事件参数-->
<i:EventTrigger EventName="Click">
<ei:CallMethodAction TargetObject="{Binding}" MethodName="SubmitClicked"/>
</i:EventTrigger>
<!--传递自定义参数-->
<i:EventTrigger EventName="KeyUp">
<i:InvokeCommandAction Command="{Binding WindowKeyCommand}" CommandParameter="{Binding ElementName=txtCardNo}"/>
</i:EventTrigger>
<!--传递多个参数-->
<i:EventTrigger EventName="KeyDown">
<i:InvokeCommandAction Command="{Binding WindowKeyCommand}" >
<i:InvokeCommandAction.CommandParameter >
<MultiBinding Converter="{StaticResource buttonMultiValueConverter}">
<Binding ElementName="button1" />
<Binding ElementName="button2" />
</MultiBinding>
</i:InvokeCommandAction.CommandParameter>
</i:InvokeCommandAction>
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>

浙公网安备 33010602011771号