using Avalonia.Controls.Primitives; namespace Avalonia.Controls { /// /// A toggle button for use in a . /// public class CommandBarToggleButton : ToggleButton, ICommandBarElement { /// /// Defines the property. /// public static readonly StyledProperty LabelProperty = AvaloniaProperty.Register(nameof(Label)); /// /// Defines the property. /// public static readonly StyledProperty IconProperty = AvaloniaProperty.Register(nameof(Icon)); /// /// Defines the property. /// public static readonly StyledProperty IsCompactProperty = AvaloniaProperty.Register(nameof(IsCompact)); /// /// Defines the property. /// public static readonly StyledProperty DynamicOverflowOrderProperty = AvaloniaProperty.Register(nameof(DynamicOverflowOrder)); /// /// Defines the property. /// public static readonly StyledProperty LabelPositionProperty = AvaloniaProperty.Register(nameof(LabelPosition), CommandBarDefaultLabelPosition.Bottom); /// /// Defines the property. /// public static readonly StyledProperty IsInOverflowProperty = AvaloniaProperty.Register(nameof(IsInOverflow)); /// /// Gets or sets the text label for the button. /// public string? Label { get => GetValue(LabelProperty); set => SetValue(LabelProperty, value); } /// /// Gets or sets the icon content for the button. /// public object? Icon { get => GetValue(IconProperty); set => SetValue(IconProperty, value); } /// /// Gets or sets whether the button is in compact mode (icon only, label hidden). /// public bool IsCompact { get => GetValue(IsCompactProperty); set => SetValue(IsCompactProperty, value); } /// /// Gets or sets the order in which this button moves to the overflow menu when space is limited. /// Lower values have higher priority (stay visible longer). /// public int DynamicOverflowOrder { get => GetValue(DynamicOverflowOrderProperty); set => SetValue(DynamicOverflowOrderProperty, value); } /// /// Gets or sets the label position. This is set automatically by the parent . /// public CommandBarDefaultLabelPosition LabelPosition { get => GetValue(LabelPositionProperty); set => SetValue(LabelPositionProperty, value); } /// /// Gets or sets whether this button is displayed inside the overflow popup. /// Set automatically by when moving items between primary and overflow. /// public bool IsInOverflow { get => GetValue(IsInOverflowProperty); set => SetValue(IsInOverflowProperty, value); } } }