diff --git a/samples/ControlCatalog/Pages/AcrylicPage.xaml b/samples/ControlCatalog/Pages/AcrylicPage.xaml index 96cfcc5288..7635e1ccc3 100644 --- a/samples/ControlCatalog/Pages/AcrylicPage.xaml +++ b/samples/ControlCatalog/Pages/AcrylicPage.xaml @@ -16,13 +16,13 @@ - - + + - - + + diff --git a/samples/ControlCatalog/Pages/SliderPage.xaml b/samples/ControlCatalog/Pages/SliderPage.xaml index eeb198976b..b4901ec780 100644 --- a/samples/ControlCatalog/Pages/SliderPage.xaml +++ b/samples/ControlCatalog/Pages/SliderPage.xaml @@ -45,6 +45,12 @@ + + diff --git a/src/Avalonia.Controls/Slider.cs b/src/Avalonia.Controls/Slider.cs index 74de33529a..e02efc2bd2 100644 --- a/src/Avalonia.Controls/Slider.cs +++ b/src/Avalonia.Controls/Slider.cs @@ -49,6 +49,12 @@ namespace Avalonia.Controls public static readonly StyledProperty OrientationProperty = ScrollBar.OrientationProperty.AddOwner(); + /// + /// Defines the property. + /// + public static readonly StyledProperty IsDirectionReversedProperty = + Track.IsDirectionReversedProperty.AddOwner(); + /// /// Defines the property. /// @@ -83,7 +89,6 @@ namespace Avalonia.Controls private IDisposable _increaseButtonSubscription; private IDisposable _increaseButtonReleaseDispose; private IDisposable _pointerMovedDispose; - private IDisposable _trackOnKeyDownDispose; private const double Tolerance = 0.0001; @@ -93,6 +98,7 @@ namespace Avalonia.Controls static Slider() { PressedMixin.Attach(); + FocusableProperty.OverrideDefaultValue(true); OrientationProperty.OverrideDefaultValue(typeof(Slider), Orientation.Horizontal); Thumb.DragStartedEvent.AddClassHandler((x, e) => x.OnThumbDragStarted(e), RoutingStrategies.Bubble); Thumb.DragCompletedEvent.AddClassHandler((x, e) => x.OnThumbDragCompleted(e), @@ -127,6 +133,19 @@ namespace Avalonia.Controls set { SetValue(OrientationProperty, value); } } + /// + /// Gets or sets the direction of increasing value. + /// + /// + /// true if the direction of increasing value is to the left for a horizontal slider or + /// down for a vertical slider; otherwise, false. The default is false. + /// + public bool IsDirectionReversed + { + get { return GetValue(IsDirectionReversedProperty); } + set { SetValue(IsDirectionReversedProperty, value); } + } + /// /// Gets or sets a value that indicates whether the automatically moves the to the closest tick mark. /// @@ -165,7 +184,6 @@ namespace Avalonia.Controls _increaseButtonSubscription?.Dispose(); _increaseButtonReleaseDispose?.Dispose(); _pointerMovedDispose?.Dispose(); - _trackOnKeyDownDispose?.Dispose(); _decreaseButton = e.NameScope.Find