Export (0) Print
Expand All

ToggleButton.IsChecked Property

Gets or sets whether the ToggleButton is checked. This is a dependency property.

Namespace:  System.Windows.Controls.Primitives
Assembly:  PresentationFramework (in PresentationFramework.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation

'Declaration
<TypeConverterAttribute(GetType(NullableBoolConverter))> _
<LocalizabilityAttribute(LocalizationCategory.None, Readability := Readability.Unreadable)> _
Public Property IsChecked As Nullable(Of Boolean)
'Usage
Dim instance As ToggleButton 
Dim value As Nullable(Of Boolean)

value = instance.IsChecked

instance.IsChecked = value
<object IsChecked="Boolean"/>- or -<object IsChecked="{x:Null Markup Extension}"/>

Property Value

Type: System.Nullable(Of Boolean)
true if the ToggleButton is checked; false if the ToggleButton is unchecked; otherwise Nothing. The default is false.

Identifier field

IsCheckedProperty

Metadata properties set to true

BindsTwoWayByDefault

A control that inherits from ToggleButton determines its behavior when this property is Nothing.

CheckBox

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.

State of the CheckBox

Value of IsChecked

Checked

true

Unchecked

false

Indeterminate

Nothing

If IsThreeState is false, you can still programmatically set this property to Nothing to put the CheckBox in an indeterminate state, but the user cannot set the CheckBox to the indeterminate state through the user interface (UI).

RadioButton

If you set this property to Nothing on a RadioButton, the RadioButton is unchecked.

The following example creates a CheckBox set to an indeterminate state.

<CheckBox Name="checkBox1" IsThreeState="True" 
          IsChecked="{x:Null}">
  A CheckBox in the indeterminate state
</CheckBox>

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0

Community Additions

ADD
Show:
© 2014 Microsoft