在Checkbox.Checked或Unchecked上执行命令 [英] Executing a command on Checkbox.Checked or Unchecked

查看:212
本文介绍了在Checkbox.Checked或Unchecked上执行命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个窗口的复选框控件。我想执行一个命令,将在相关联的视图模型中调用一个方法。我还需要复选框的值。我似乎找不到一个方法来关联命令与复选框。有没有人这样做?

I have a checkbox control on a window. I'd like to execute a command that will call a method in the associated view model. I'll also need the value of the checkbox as well. I cannot seem to find a way to associate a command with a checkbox. Has anyone done this?

推荐答案

 <CheckBox Content="CheckBox" Height="16" HorizontalAlignment="Left" 
 Margin="176,132,0,0" Name="checkBox1" VerticalAlignment="Top"
 Command="{Binding YourCommand}" />

这篇关于在Checkbox.Checked或Unchecked上执行命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆