Class ToggleButton
- Namespace
- Avalonia.Controls.Primitives
- Assembly
- Avalonia.Controls.dll
Represents a control that a user can select (check) or clear (uncheck). Base class for controls that can switch states.
[PseudoClasses(new string[] { ":checked", ":unchecked", ":indeterminate" })]
public class ToggleButton : Button, INotifyPropertyChanged, IDataContextProvider, ILogical, IThemeVariantHost, IResourceHost, IResourceNode, IStyleHost, ISetLogicalParent, ISetInheritanceParent, ISupportInitialize, IStyleable, INamed, IInputElement, IDataTemplateHost, ISetterValue, ICommandSource
- Inheritance
-
ToggleButton
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
ToggleButton()
public ToggleButton()
Fields
IsCheckedChangedEvent
Defines the IsCheckedChanged event.
public static readonly RoutedEvent<RoutedEventArgs> IsCheckedChangedEvent
Field Value
IsCheckedProperty
Defines the IsChecked property.
public static readonly StyledProperty<bool?> IsCheckedProperty
Field Value
IsThreeStateProperty
Defines the IsThreeState property.
public static readonly StyledProperty<bool> IsThreeStateProperty
Field Value
Properties
IsChecked
Gets or sets whether the ToggleButton is checked.
public bool? IsChecked { get; set; }
Property Value
- bool?
IsThreeState
Gets or sets a value that indicates whether the control supports three states.
public bool IsThreeState { get; set; }
Property Value
Methods
OnClick()
Invokes the Click event.
protected override void OnClick()
OnCreateAutomationPeer()
Returns a new, type-specific AutomationPeer implementation for the control.
protected override AutomationPeer OnCreateAutomationPeer()
Returns
- AutomationPeer
The type-specific AutomationPeer implementation.
OnIsCheckedChanged(RoutedEventArgs)
Called when IsChecked changes.
protected virtual void OnIsCheckedChanged(RoutedEventArgs e)
Parameters
e
RoutedEventArgsEvent arguments for the routed event that is raised by the default implementation of this method.
OnPropertyChanged(AvaloniaPropertyChangedEventArgs)
Called when a avalonia property changes on the object.
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
Parameters
change
AvaloniaPropertyChangedEventArgsThe property change details.
Toggle()
Toggles the IsChecked property.
protected virtual void Toggle()
Events
IsCheckedChanged
Raised when the IsChecked property value changes.
public event EventHandler<RoutedEventArgs>? IsCheckedChanged