Table of Contents

Class ToggleSplitButton

Namespace
Avalonia.Controls
Assembly
Avalonia.Controls.dll

A button with primary and secondary parts that can each be pressed separately. The primary part behaves like a ToggleButton with two states and the secondary part opens a flyout.

[PseudoClasses(new string[] { ":checked" })]
public class ToggleSplitButton : SplitButton, INotifyPropertyChanged, IDataContextProvider, ILogical, IThemeVariantHost, IResourceHost, IResourceNode, IStyleHost, ISetLogicalParent, ISetInheritanceParent, ISupportInitialize, IStyleable, INamed, IInputElement, IDataTemplateHost, ISetterValue, ICommandSource
Inheritance
ToggleSplitButton
Implements
Inherited Members
Extension Methods

Constructors

ToggleSplitButton()

Initializes a new instance of the ToggleSplitButton class.

public ToggleSplitButton()

Fields

IsCheckedChangedEvent

Defines the IsCheckedChanged event.

public static readonly RoutedEvent<RoutedEventArgs> IsCheckedChangedEvent

Field Value

RoutedEvent<RoutedEventArgs>

IsCheckedProperty

Defines the IsChecked property.

public static readonly StyledProperty<bool> IsCheckedProperty

Field Value

StyledProperty<bool>

Properties

IsChecked

Gets or sets a value indicating whether the ToggleSplitButton is checked.

public bool IsChecked { get; set; }

Property Value

bool

StyleKeyOverride

Gets the type by which the element is styled.

protected override Type StyleKeyOverride { get; }

Property Value

Type

Remarks

Usually controls are styled by their own type, but there are instances where you want an element to be styled by its base type, e.g. creating SpecialButton that derives from Button and adds extra functionality but is still styled as a regular Button. Override this property to change the style for a control class, returning the type that you wish the elements to be styled as.

Methods

OnClickPrimary(RoutedEventArgs?)

Invokes the Click event when the primary button part is clicked.

protected override void OnClickPrimary(RoutedEventArgs? e)

Parameters

e RoutedEventArgs

The event args from the internal Click event.

OnIsCheckedChanged()

Invokes the IsCheckedChanged event when the IsChecked property changes.

protected virtual void OnIsCheckedChanged()

OnPropertyChanged(AvaloniaPropertyChangedEventArgs)

Called when a avalonia property changes on the object.

protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs e)

Parameters

e AvaloniaPropertyChangedEventArgs

Toggle()

Toggles the IsChecked property between true and false.

protected void Toggle()

Events

IsCheckedChanged

Raised when the IsChecked property value changes.

public event EventHandler<RoutedEventArgs>? IsCheckedChanged

Event Type

EventHandler<RoutedEventArgs>