Browse Source

Scaffold IScrollAnchorProvider on ScrollViewer.

It doesn't do anything yet, but `ItemsPresenter` requires `ScrollViewer` to implement this interface.
pull/2603/head
Steven Kirk 7 years ago
parent
commit
5d813c9011
  1. 2
      src/Avalonia.Controls/Repeaters/ViewportManager.cs
  2. 15
      src/Avalonia.Controls/ScrollViewer.cs

2
src/Avalonia.Controls/Repeaters/ViewportManager.cs

@ -365,7 +365,7 @@ namespace Avalonia.Controls.Repeaters
public void ResetScrollers()
{
_scroller = null;
_effectiveViewportChangedRevoker.Dispose();
_effectiveViewportChangedRevoker?.Dispose();
_effectiveViewportChangedRevoker = null;
_ensuredScroller = false;
}

15
src/Avalonia.Controls/ScrollViewer.cs

@ -11,7 +11,7 @@ namespace Avalonia.Controls
/// <summary>
/// A control scrolls its content if the content is bigger than the space available.
/// </summary>
public class ScrollViewer : ContentControl, IScrollable
public class ScrollViewer : ContentControl, IScrollable, IScrollAnchorProvider
{
/// <summary>
/// Defines the <see cref="CanHorizontallyScroll"/> property.
@ -333,6 +333,9 @@ namespace Avalonia.Controls
get { return _viewport.Height; }
}
/// <inheritdoc/>
IControl IScrollAnchorProvider.CurrentAnchor => null; // TODO: Implement
/// <summary>
/// Gets the value of the HorizontalScrollBarVisibility attached property.
/// </summary>
@ -373,6 +376,16 @@ namespace Avalonia.Controls
control.SetValue(VerticalScrollBarVisibilityProperty, value);
}
void IScrollAnchorProvider.RegisterAnchorCandidate(IControl element)
{
// TODO: Implement
}
void IScrollAnchorProvider.UnregisterAnchorCandidate(IControl element)
{
// TODO: Implement
}
internal static Vector CoerceOffset(Size extent, Size viewport, Vector offset)
{
var maxX = Math.Max(extent.Width - viewport.Width, 0);

Loading…
Cancel
Save