如何设置checkbox.isChecked没有筹款活动 [英] How to set checkbox.isChecked without raising event

查看:178
本文介绍了如何设置checkbox.isChecked没有筹款活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有检查复选框不运行相关联的检查它的代码的方法吗? 。只是外观

Is there a way of checking the CheckBox without running the code associated to checking it? Just for visual appearance.

编辑:

private void normalCheck_Checked(object sender, RoutedEventArgs e)
{
    normal();
}



想象一下,我想设置的 normalCheckBox.IsChecked = TRUE; ,但没有引发事件。这可能吗?

Imagine that I want to set the normalCheckBox.IsChecked=true; but without raising the event. Is that possible?

推荐答案

的一种方法是分离的事件处理程序,将器isChecked 属性,然后重新接通

One way would be to detach the event handler, set the IsChecked property, and then reattach it.

myCheckbox.Checked -= myCheckbox_Checked;
myCheckbox.IsChecked = true;
myCheckbox.Checked += myCheckbox_Checked;

这篇关于如何设置checkbox.isChecked没有筹款活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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