Melissa 3 days ago
committed by GitHub
parent
commit
86606a42f7
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 38
      src/Avalonia.Controls/Primitives/ScrollBar.cs
  2. 23
      src/Avalonia.Controls/ScrollViewer.cs

38
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;
}
}
}

23
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;
}
}
}
/// <summary>

Loading…
Cancel
Save