Browse Source

Invalidate measure when clearing anchor.

pull/4091/head
Steven Kirk 6 years ago
parent
commit
ca7b1d75cd
  1. 1
      samples/ControlCatalog/Pages/ItemsRepeaterPage.xaml.cs
  2. 17
      src/Avalonia.Controls/Repeater/ViewportManager.cs

1
samples/ControlCatalog/Pages/ItemsRepeaterPage.xaml.cs

@ -84,6 +84,7 @@ namespace ControlCatalog.Pages
private void ScrollTo(int index)
{
System.Diagnostics.Debug.WriteLine("Scroll to " + index);
var layoutManager = ((Window)this.GetVisualRoot()).LayoutManager;
var element = _repeater.GetOrCreateElement(index);
layoutManager.ExecuteLayoutPass();

17
src/Avalonia.Controls/Repeater/ViewportManager.cs

@ -383,19 +383,10 @@ namespace Avalonia.Controls
_isBringIntoViewInProgress = false;
_makeAnchorElement = null;
// Now that the item has been brought into view, we can let the anchor provider pick a new anchor.
////foreach (var child in _owner.Children)
////{
//// if (!child.CanBeScrollAnchor)
//// {
//// var info = ItemsRepeater.GetVirtualizationInfo(child);
//// if (info.IsRealized && info.IsHeldByLayout)
//// {
//// child.CanBeScrollAnchor = true;
//// }
//// }
////}
// HACK: Invalidate measure now that the anchor has been removed so that a layout can be
// done with a proper realization rect. This is a hack not present upstream to try to fix
// https://github.com/microsoft/microsoft-ui-xaml/issues/1422
TryInvalidateMeasure();
}
public void ResetScrollers()

Loading…
Cancel
Save