首页 > 其他 > 详细

TriggerAction扩展----ExInvokeCommandAction

时间:2014-04-02 08:23:39      阅读:454      评论:0      收藏:0      [点我收藏+]

 Wp&Win8中使用命令绑定时,除了Button控件自带命令绑定,其他的时候是用Interactivity库中的InvokeCommandAction实现的(Win8 需要额外安装第三方NuGet包才可使用,我的MVFM示例博客中带有这个库),但使用过程中发现InvokeCommandAction并不能满足我们的要求,主要有以下几点:

  1 无法获取发送者;
  2 用EventTrigger触发时往往需要用到EventArg参数,但是InvokeCommandAction无法获取;
  3 有时需要传递多个参数,无法满足;
  于是我对InvokeCommandAction进行了一些改进,首先定义参数的结构体:
 

   然后定义处理的TriggerAction:

  

  使用时和InvokeCommandAction是一样的:
 
1
2
3
4
5
<i:Interaction.Triggers>
    <i:EventTrigger EventName="Loaded"
         <Behavior:ExInvokeCommandAction Command="{Binding Command,Source={StaticResource ViewModel}}" CommandParameter="1" CommandParameter2="2" CommandParameter3="3"/>
    </i:EventTrigger>
</i:Interaction.Triggers>

  

TriggerAction扩展----ExInvokeCommandAction,布布扣,bubuko.com

TriggerAction扩展----ExInvokeCommandAction

原文:http://www.cnblogs.com/walleyekneel/p/3639296.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!