Namespace:
System.Windows.Controls.Primitives
Assembly:
System.Windows (in System.Windows.dll)
Visual Basic (Declaration)
<TemplateVisualStateAttribute(Name := "Normal", GroupName := "CommonStates")> _
<TemplateVisualStateAttribute(Name := "Unchecked", GroupName := "CheckStates")> _
<TemplateVisualStateAttribute(Name := "Indeterminate", GroupName := "CheckStates")> _
<TemplateVisualStateAttribute(Name := "MouseOver", GroupName := "CommonStates")> _
<TemplateVisualStateAttribute(Name := "Pressed", GroupName := "CommonStates")> _
<TemplateVisualStateAttribute(Name := "Disabled", GroupName := "CommonStates")> _
<TemplateVisualStateAttribute(Name := "Unfocused", GroupName := "FocusStates")> _
<TemplateVisualStateAttribute(Name := "Focused", GroupName := "FocusStates")> _
<TemplateVisualStateAttribute(Name := "Checked", GroupName := "CheckStates")> _
Public Class ToggleButton _
Inherits ButtonBase
Dim instance As ToggleButton
[TemplateVisualStateAttribute(Name = "Normal", GroupName = "CommonStates")]
[TemplateVisualStateAttribute(Name = "Unchecked", GroupName = "CheckStates")]
[TemplateVisualStateAttribute(Name = "Indeterminate", GroupName = "CheckStates")]
[TemplateVisualStateAttribute(Name = "MouseOver", GroupName = "CommonStates")]
[TemplateVisualStateAttribute(Name = "Pressed", GroupName = "CommonStates")]
[TemplateVisualStateAttribute(Name = "Disabled", GroupName = "CommonStates")]
[TemplateVisualStateAttribute(Name = "Unfocused", GroupName = "FocusStates")]
[TemplateVisualStateAttribute(Name = "Focused", GroupName = "FocusStates")]
[TemplateVisualStateAttribute(Name = "Checked", GroupName = "CheckStates")]
public class ToggleButton : ButtonBase
XAML Object Element Usage
<ToggleButton .../>
-or-
<togglebutton>
singleObject
</togglebutton>
XAML Values
- singleObject
A single object element that declares the content.
- togglebutton
A ToggleButton object element or an object element for a class that derives from ToggleButton.
The IsChecked property specifies the state of the ToggleButton. The IsThreeState property specifies whether the ToggleButton has two or three states. If the ToggleButton is configured to have three states, it allows the user to choose a third, indeterminate state. For example, you could use a three-state toggle button to indicate Yes, No, or Not Applicable.
Content Model: ToggleButton is a ContentControl. Its content property is Content. For more information, see Control Content Models.
The following example shows how to create a three-state ToggleButton control.
Run this sample
<ToggleButton Margin="5" Content="Three State" Width="150" IsThreeState="True"/>
<ToggleButton Margin="5" Content="Two State" Width="150" IsThreeState="False" />
System..::.Object
System.Windows..::.DependencyObject
System.Windows..::.UIElement
System.Windows..::.FrameworkElement
System.Windows.Controls..::.Control
System.Windows.Controls..::.ContentControl
System.Windows.Controls.Primitives..::.ButtonBase
System.Windows.Controls.Primitives..::.ToggleButton
System.Windows.Controls..::.CheckBox
System.Windows.Controls..::.RadioButton
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.
Reference
Other Resources