Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

ToggleButton.IsChecked Property

Definition

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

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#, 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


Feedback

Was this page helpful?