Browse Source

Fix NRE when VirtualizingStackPanel used with ItemsControl.

There is no `ScrollViewer` in the template for `ItemsControl` which means that if a `VirtualizingStackPanel` is used for `ItemsControl.ItemsPanel` then `InvalidateScroll` won't be set. Just do nothing in this case.

Fixes #1829.
pull/1863/head
Steven Kirk 8 years ago
parent
commit
544d2e26c7
  1. 2
      src/Avalonia.Controls/Presenters/ItemVirtualizer.cs

2
src/Avalonia.Controls/Presenters/ItemVirtualizer.cs

@ -279,6 +279,6 @@ namespace Avalonia.Controls.Presenters
/// <summary>
/// Invalidates the current scroll.
/// </summary>
protected void InvalidateScroll() => ((ILogicalScrollable)Owner).InvalidateScroll();
protected void InvalidateScroll() => ((ILogicalScrollable)Owner).InvalidateScroll?.Invoke();
}
}

Loading…
Cancel
Save