2012-07-05 131 views
0

试图在WPF chekboxclickchecked事件的command绑定在我的视图模型,但即时通讯上的技术和事件名称,任何人都可以点我在正确的方向不确定?WPF复选框,触发器

对于现在的代码编译,但在trigger不会调用FooCommand

<CheckBox IsChecked="{Binding PartData.ReportIncluded, Mode=TwoWay}" 
      VerticalAlignment="Center"> 
    <i:Interaction.Triggers> 
     <i:EventTrigger EventName="MouseLeftButtonDown" > 
      <i:InvokeCommandAction Command="{Binding FooCommand}" /> 
     </i:EventTrigger> 
    </i:Interaction.Triggers> 
</CheckBox> 

回答

0

看起来你错过了“关于”您事件的前缀,即OnMouseLeftButtonDown在或OnPreviewMouseLeftButtonDown

+0

尝试OnMouseLeftButton和OnPreviewMouseLeftButtonDown和OnChecked,什么都不起作用 – klashagelqvist 2012-07-06 07:40:18

+0

i:Interaction.Triggers是否适用于其他控件上的evens? – Josh 2012-07-06 13:10:10

+0

感谢您的anwswers,如果发现它,触发器在具有自己的datacontext的hirearciacal数据模板中,而fooCommand在usercontrol数据环境中,这就是为什么它永远不会被称为 – klashagelqvist 2012-07-06 13:25:11