using System; using System.Diagnostics; using System.Linq; using System.Windows.Input; using Avalonia.Automation.Peers; using Avalonia.Controls.Metadata; using Avalonia.Controls.Primitives; using Avalonia.Controls.Templates; using Avalonia.Data; using Avalonia.Input; using Avalonia.Interactivity; using Avalonia.LogicalTree; using Avalonia.VisualTree; namespace Avalonia.Controls { /// /// Defines how a reacts to clicks. /// public enum ClickMode { /// /// The event is raised when the pointer is released. /// Release, /// /// The event is raised when the pointer is pressed. /// Press, } /// /// A standard button control. /// [PseudoClasses(pcFlyoutOpen, pcPressed)] public class Button : ContentControl, ICommandSource, IClickableControl { protected const string pcPressed = ":pressed"; protected const string pcFlyoutOpen = ":flyout-open"; /// /// Defines the property. /// public static readonly StyledProperty ClickModeProperty = AvaloniaProperty.Register(nameof(ClickMode)); /// /// Defines the property. /// public static readonly DirectProperty CommandProperty = AvaloniaProperty.RegisterDirect(nameof(Command), button => button.Command, (button, command) => button.Command = command, enableDataValidation: true); /// /// Defines the property. /// public static readonly StyledProperty HotKeyProperty = HotKeyManager.HotKeyProperty.AddOwner