ToggleButton.IsChecked Property
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 Nullable<bool> IsChecked { Nullable<bool> get(); void set(Nullable<bool> value); };
[System.ComponentModel.TypeConverter(typeof(System.Windows.NullableBoolConverter))]
[System.Windows.Localizability(System.Windows.LocalizationCategory.None, Readability=System.Windows.Readability.Unreadable)]
public bool? IsChecked { get; set; }
[<System.ComponentModel.TypeConverter(typeof(System.Windows.NullableBoolConverter))>]
[<System.Windows.Localizability(System.Windows.LocalizationCategory.None, Readability=System.Windows.Readability.Unreadable)>]
member this.IsChecked : Nullable<bool> with get, set
Public Property IsChecked As Nullable(Of Boolean)
true
if the ToggleButton is checked; false if the ToggleButton is unchecked; otherwise null
. The default is false
.
- Attributes
The following example creates a CheckBox set to an indeterminate state.
<CheckBox Name="checkBox1" IsThreeState="True"
IsChecked="{x:Null}">
A CheckBox in an indeterminate state
</CheckBox>
A control that inherits from ToggleButton determines its behavior when this property is null
.
When the IsThreeState property is set to true, a user can click a CheckBox to pick three possible states. The following table describes the three states of a CheckBox.
If IsThreeState is false, you can still programmatically set this property to null
to put the CheckBox in an indeterminate state, but the user cannot set the CheckBox to the indeterminate state through the user interface (UI).
If you set this property to null
on a RadioButton, the RadioButton is unchecked.
<object IsChecked
="Boolean"/>
-or-
<object IsChecked
="{x:Null Markup Extension}"/>
Item | Value |
---|---|
Identifier field | IsCheckedProperty |
Metadata properties set to true |
BindsTwoWayByDefault |
Product | Versions |
---|---|
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9, 10 |
.NET feedback
.NET is an open source project. Select a link to provide feedback: