Class ToggleButton
Base class for controls that can switch states, such as CheckBox and RadioButton.
Inheritance
Inherited Members
Namespace: System.Windows.Controls.Primitives
Assembly: OpenSilver.dll
Syntax
public class ToggleButton : ButtonBase
Constructors
| Improve this Doc View SourceToggleButton()
Initializes a new instance of the ToggleButton class.
Declaration
public ToggleButton()
Fields
| Improve this Doc View SourceIsCheckedProperty
Identifies the IsChecked dependency property.
Declaration
public static readonly DependencyProperty IsCheckedProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
IsThreeStateProperty
Identifies the IsThreeState dependency property.
Declaration
public static readonly DependencyProperty IsThreeStateProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
Properties
| Improve this Doc View SourceIsChecked
Gets or sets whether the ToggleButton is checked.
Declaration
public bool? IsChecked { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Boolean> |
|
IsThreeState
Gets or sets whether the control supports two or three states.
Declaration
public bool IsThreeState { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Methods
| Improve this Doc View SourceOnChecked(RoutedEventArgs)
Raises the Checked event.
Declaration
protected virtual void OnChecked(RoutedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
RoutedEventArgs | e |
OnClick()
Called when the ToggleButton is clicked by the mouse or the keyboard.
Declaration
protected override void OnClick()
Overrides
| Improve this Doc View SourceOnContentChanged(Object, Object)
Called when the ContentControl property changes.
Declaration
protected override void OnContentChanged(object oldContent, object newContent)
Parameters
Type | Name | Description |
---|---|---|
System.Object | oldContent | The content to be replaced. |
System.Object | newContent | The new content to display. |
Overrides
| Improve this Doc View SourceOnIndeterminate(RoutedEventArgs)
Raises the Indeterminate event.
Declaration
protected virtual void OnIndeterminate(RoutedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
RoutedEventArgs | e |
OnToggle()
Called by the OnClick() method to implement toggle behavior.
Declaration
protected virtual void OnToggle()
OnUnchecked(RoutedEventArgs)
Raises the Unchecked event.
Declaration
protected virtual void OnUnchecked(RoutedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
RoutedEventArgs | e |
ToString()
Returns the string representation of a ToggleButton object.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String |
Overrides
Events
| Improve this Doc View SourceChecked
Occurs when a ToggleButton is checked.
Declaration
public event RoutedEventHandler Checked
Event Type
Type | Description |
---|---|
RoutedEventHandler |
Indeterminate
Occurs when the state of a ToggleButton is switched to the indeterminate state.
Declaration
public event RoutedEventHandler Indeterminate
Event Type
Type | Description |
---|---|
RoutedEventHandler |
Unchecked
Occurs when a ToggleButton is unchecked.
Declaration
public event RoutedEventHandler Unchecked
Event Type
Type | Description |
---|---|
RoutedEventHandler |