diff --git a/src/Avalonia.Controls/Primitives/RangeBase.cs b/src/Avalonia.Controls/Primitives/RangeBase.cs
index 878f76c033..b69dbba637 100644
--- a/src/Avalonia.Controls/Primitives/RangeBase.cs
+++ b/src/Avalonia.Controls/Primitives/RangeBase.cs
@@ -38,6 +38,18 @@ namespace Avalonia.Controls.Primitives
o => o.Value,
(o, v) => o.Value = v);
+ ///
+ /// Defines the property.
+ ///
+ public static readonly StyledProperty SmallChangeProperty =
+ AvaloniaProperty.Register(nameof(SmallChange), 0.1);
+
+ ///
+ /// Defines the property.
+ ///
+ public static readonly StyledProperty LargeChangeProperty =
+ AvaloniaProperty.Register(nameof(LargeChange), 1);
+
private double _minimum;
private double _maximum = 100.0;
private double _value;
@@ -103,6 +115,18 @@ namespace Avalonia.Controls.Primitives
}
}
+ public double SmallChange
+ {
+ get => GetValue(SmallChangeProperty);
+ set => SetValue(SmallChangeProperty, value);
+ }
+
+ public double LargeChange
+ {
+ get => GetValue(LargeChangeProperty);
+ set => SetValue(LargeChangeProperty, value);
+ }
+
///
/// Throws an exception if the double valus is NaN or Inf.
///
diff --git a/src/Avalonia.Controls/Primitives/ScrollBar.cs b/src/Avalonia.Controls/Primitives/ScrollBar.cs
index 1fab5ca4ad..0f69e4e5bc 100644
--- a/src/Avalonia.Controls/Primitives/ScrollBar.cs
+++ b/src/Avalonia.Controls/Primitives/ScrollBar.cs
@@ -5,6 +5,7 @@ using System;
using System.Reactive;
using System.Reactive.Linq;
using Avalonia.Data;
+using Avalonia.Interactivity;
namespace Avalonia.Controls.Primitives
{
@@ -31,13 +32,18 @@ namespace Avalonia.Controls.Primitives
public static readonly StyledProperty OrientationProperty =
AvaloniaProperty.Register(nameof(Orientation));
+ private Button _lineUpButton;
+ private Button _lineDownButton;
+ private Button _pageUpButton;
+ private Button _pageDownButton;
+
///
/// Initializes static members of the class.
///
static ScrollBar()
{
- PseudoClass(OrientationProperty, o => o == Avalonia.Controls.Orientation.Vertical, ":vertical");
- PseudoClass(OrientationProperty, o => o == Avalonia.Controls.Orientation.Horizontal, ":horizontal");
+ PseudoClass(OrientationProperty, o => o == Orientation.Vertical, ":vertical");
+ PseudoClass(OrientationProperty, o => o == Orientation.Horizontal, ":horizontal");
}
///
@@ -97,12 +103,101 @@ namespace Avalonia.Controls.Primitives
return false;
case ScrollBarVisibility.Auto:
- var viewportSize = ViewportSize;
- return double.IsNaN(viewportSize) || viewportSize < Maximum - Minimum;
+ return double.IsNaN(ViewportSize) || Maximum > 0;
default:
throw new InvalidOperationException("Invalid value for ScrollBar.Visibility.");
}
}
+
+ protected override void OnTemplateApplied(TemplateAppliedEventArgs e)
+ {
+ base.OnTemplateApplied(e);
+
+ if (_lineUpButton != null)
+ {
+ _lineUpButton.Click -= LineUpClick;
+ }
+
+ if (_lineDownButton != null)
+ {
+ _lineDownButton.Click -= LineDownClick;
+ }
+
+ if (_pageUpButton != null)
+ {
+ _pageUpButton.Click -= PageUpClick;
+ }
+
+ if (_pageDownButton != null)
+ {
+ _pageDownButton.Click -= PageDownClick;
+ }
+
+ _lineUpButton = e.NameScope.Find
protected double HorizontalScrollBarViewportSize
{
- get { return Max((_viewport.Width / _extent.Width) * (_extent.Width - _viewport.Width), 0); }
+ get { return _viewport.Width; }
}
///
@@ -308,7 +308,7 @@ namespace Avalonia.Controls
///
protected double VerticalScrollBarViewportSize
{
- get { return Max((_viewport.Height / _extent.Height) * (_extent.Height - _viewport.Height), 0); }
+ get { return _viewport.Height; }
}
///
diff --git a/src/Avalonia.Controls/Slider.cs b/src/Avalonia.Controls/Slider.cs
index 6bbfb8fd8d..beef4e842e 100644
--- a/src/Avalonia.Controls/Slider.cs
+++ b/src/Avalonia.Controls/Slider.cs
@@ -33,6 +33,8 @@ namespace Avalonia.Controls
// Slider required parts
private Track _track;
+ private Button _decreaseButton;
+ private Button _increaseButton;
///
/// Initializes static members of the class.
@@ -83,7 +85,39 @@ namespace Avalonia.Controls
///
protected override void OnTemplateApplied(TemplateAppliedEventArgs e)
{
- _track = e.NameScope.Get