ToggleButton.IsChecked Property

Definition

Gets or sets whether the ToggleButton is checked.

public:
 property IReference<bool> ^ IsChecked { IReference<bool> ^ get(); void set(IReference<bool> ^ value); };
IReference<bool> IsChecked();

void IsChecked(IReference<bool> value);
public System.Nullable<bool> IsChecked { get; set; }
var iReference = toggleButton.isChecked;
toggleButton.isChecked = iReference;
Public Property IsChecked As Nullable(Of Boolean)
<togglebutton IsChecked="bool"/>
-or-
<togglebutton IsChecked="{x:Null}"/>

Property Value

true if the ToggleButton is checked; false if the ToggleButton is unchecked; otherwise null. The default is false.

If you are programming using C# or Microsoft Visual Basic, the type of this property is projected as bool? (a nullable Boolean).

Remarks

ToggleButton and can have three states:

StatePropertyValue
checkedIsCheckedtrue
uncheckedIsCheckedfalse
indeterminateIsCheckednull

For the ToggleButton to report the indeterminate state, you must set the IsThreeState property to true.

Note

ToggleButton has the same visual state for the indeterminate and unchecked states. Derived controls, like CheckBox, may define different visual states for each state.

To set the value to null in XAML, use the {x:Null} markup extension.

Applies to

See also