diff --git a/src/Avalonia.Controls/Primitives/ScrollBar.cs b/src/Avalonia.Controls/Primitives/ScrollBar.cs index 89dcb9a8d4..17cf8b431a 100644 --- a/src/Avalonia.Controls/Primitives/ScrollBar.cs +++ b/src/Avalonia.Controls/Primitives/ScrollBar.cs @@ -247,15 +247,41 @@ namespace Avalonia.Controls.Primitives protected override void OnKeyDown(KeyEventArgs e) { - if (e.Key == Key.PageUp) + if (Orientation == Orientation.Vertical) { - LargeDecrement(); - e.Handled = true; + if (e.Key == Key.PageUp) + { + LargeDecrement(); + e.Handled = true; + } + else if (e.Key == Key.PageDown) + { + LargeIncrement(); + e.Handled = true; + } + else if (e.Key == Key.Up) + { + SmallDecrement(); + e.Handled = true; + } + else if (e.Key == Key.Down) + { + SmallIncrement(); + e.Handled = true; + } } - else if (e.Key == Key.PageDown) + else if (Orientation == Orientation.Horizontal) { - LargeIncrement(); - e.Handled = true; + if (e.Key == Key.Left) + { + SmallDecrement(); + e.Handled = true; + } + else if (e.Key == Key.Right) + { + SmallIncrement(); + e.Handled = true; + } } } diff --git a/src/Avalonia.Controls/ScrollViewer.cs b/src/Avalonia.Controls/ScrollViewer.cs index 2593c4b475..037fa260ee 100644 --- a/src/Avalonia.Controls/ScrollViewer.cs +++ b/src/Avalonia.Controls/ScrollViewer.cs @@ -786,6 +786,29 @@ namespace Avalonia.Controls PageDown(); e.Handled = true; } + else if (e.Source == this) + { + if (e.Key == Key.Left) + { + LineLeft(); + e.Handled = true; + } + else if (e.Key == Key.Right) + { + LineRight(); + e.Handled = true; + } + else if (e.Key == Key.Up) + { + LineUp(); + e.Handled = true; + } + else if (e.Key == Key.Down) + { + LineDown(); + e.Handled = true; + } + } } ///