diff --git a/samples/ControlCatalog/Pages/ButtonSpinnerPage.xaml b/samples/ControlCatalog/Pages/ButtonSpinnerPage.xaml index 760760e3f4..1797fb48bc 100644 --- a/samples/ControlCatalog/Pages/ButtonSpinnerPage.xaml +++ b/samples/ControlCatalog/Pages/ButtonSpinnerPage.xaml @@ -8,7 +8,12 @@ AllowSpin ShowButtonSpinner - + + + diff --git a/src/Avalonia.Controls/ButtonSpinner.cs b/src/Avalonia.Controls/ButtonSpinner.cs index c7b31a8c6c..3ce81e0b12 100644 --- a/src/Avalonia.Controls/ButtonSpinner.cs +++ b/src/Avalonia.Controls/ButtonSpinner.cs @@ -5,6 +5,12 @@ using Avalonia.Interactivity; namespace Avalonia.Controls { + public enum Location + { + Left, + Right + } + /// /// Represents a spinner control that includes two Buttons. /// @@ -22,6 +28,12 @@ namespace Avalonia.Controls public static readonly StyledProperty ShowButtonSpinnerProperty = AvaloniaProperty.Register(nameof(ShowButtonSpinner), true); + /// + /// Defines the property. + /// + public static readonly StyledProperty ButtonSpinnerLocationProperty = + AvaloniaProperty.Register(nameof(ButtonSpinnerLocation), Location.Right); + private Button _decreaseButton; /// /// Gets or sets the DecreaseButton template part. @@ -73,6 +85,8 @@ namespace Avalonia.Controls static ButtonSpinner() { AllowSpinProperty.Changed.Subscribe(AllowSpinChanged); + PseudoClass(ButtonSpinnerLocationProperty, location => location == Location.Left, ":left"); + PseudoClass(ButtonSpinnerLocationProperty, location => location == Location.Right, ":right"); } /// @@ -93,6 +107,15 @@ namespace Avalonia.Controls set { SetValue(ShowButtonSpinnerProperty, value); } } + /// + /// Gets or sets current location of the . + /// + public Location ButtonSpinnerLocation + { + get { return GetValue(ButtonSpinnerLocationProperty); } + set { SetValue(ButtonSpinnerLocationProperty, value); } + } + /// protected override void OnTemplateApplied(TemplateAppliedEventArgs e) { diff --git a/src/Avalonia.Themes.Default/ButtonSpinner.xaml b/src/Avalonia.Themes.Default/ButtonSpinner.xaml index 2ed6ea49b1..a08f5b5e9b 100644 --- a/src/Avalonia.Themes.Default/ButtonSpinner.xaml +++ b/src/Avalonia.Themes.Default/ButtonSpinner.xaml @@ -4,6 +4,42 @@ + + + + + + - - - - - - - - + + + \ No newline at end of file