Browse Source

Merge branch 'master' into feature/data-grid-custom-sorting

pull/4687/head
Dariusz Komosiński 6 years ago
committed by GitHub
parent
commit
3353a92d4d
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 36
      src/Avalonia.Controls/ScrollViewer.cs

36
src/Avalonia.Controls/ScrollViewer.cs

@ -448,6 +448,38 @@ namespace Avalonia.Controls
Offset += new Vector(_smallChange.Width, 0);
}
/// <summary>
/// Scrolls the content upward by one page.
/// </summary>
public void PageUp()
{
VerticalScrollBarValue = Math.Max(_offset.Y - _viewport.Height, 0);
}
/// <summary>
/// Scrolls the content downward by one page.
/// </summary>
public void PageDown()
{
VerticalScrollBarValue = Math.Min(_offset.Y + _viewport.Height, VerticalScrollBarMaximum);
}
/// <summary>
/// Scrolls the content left by one page.
/// </summary>
public void PageLeft()
{
HorizontalScrollBarValue = Math.Max(_offset.X - _viewport.Width, 0);
}
/// <summary>
/// Scrolls the content tight by one page.
/// </summary>
public void PageRight()
{
HorizontalScrollBarValue = Math.Min(_offset.X + _viewport.Width, HorizontalScrollBarMaximum);
}
/// <summary>
/// Scrolls to the top-left corner of the content.
/// </summary>
@ -623,12 +655,12 @@ namespace Avalonia.Controls
{
if (e.Key == Key.PageUp)
{
VerticalScrollBarValue = Math.Max(_offset.Y - _viewport.Height, 0);
PageUp();
e.Handled = true;
}
else if (e.Key == Key.PageDown)
{
VerticalScrollBarValue = Math.Min(_offset.Y + _viewport.Height, VerticalScrollBarMaximum);
PageDown();
e.Handled = true;
}
}

Loading…
Cancel
Save