Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set a Checkbox checked property to true

Tags:

c#

checkbox

I want to set the default property of a checkbox to true

like image 798
Sandipan Avatar asked May 31 '10 04:05

Sandipan


4 Answers

I suppose you only mean that on opening a form, one or more check boxes are checked .

Simply write in the Form_Load method

private void Form_Loaded (object sender, RoutedEventArgs e) {
    CheckBox1.IsChecked = true;
}
like image 98
A Reynaldos Avatar answered Oct 10 '22 11:10

A Reynaldos


chkEntregue.CheckState = CheckState.Checked;

like image 36
Lucas Dalcolmo Avatar answered Oct 10 '22 11:10

Lucas Dalcolmo


Set the Checked property to True in the Properties window of Visual Studio at design time.

like image 32
logicnp Avatar answered Oct 10 '22 10:10

logicnp


To set CheckBox:

 CheckBoxName.SetCurrentValue(CheckBox.IsCheckedProperty, true);

To unset CheckBox:

 CheckBoxName.SetCurrentValue(CheckBox.IsCheckedProperty, false);
like image 3
Imabezza Avatar answered Oct 10 '22 11:10

Imabezza