Browse Source

Remove hack from VirtualizingStackPanel.

No longer needed since layout invalidation was fixed in last commit.
pull/11127/head
Steven Kirk 4 years ago
parent
commit
b8fed4cbea
  1. 34
      src/Avalonia.Controls/VirtualizingStackPanel.cs

34
src/Avalonia.Controls/VirtualizingStackPanel.cs

@ -556,7 +556,6 @@ namespace Avalonia.Controls
GetItemIsOwnContainer(items, index) ?? GetItemIsOwnContainer(items, index) ??
GetRecycledElement(items, index) ?? GetRecycledElement(items, index) ??
CreateElement(items, index); CreateElement(items, index);
InvalidateHack(e);
return e; return e;
} }
@ -705,39 +704,6 @@ namespace Avalonia.Controls
} }
} }
private static void InvalidateHack(Control c)
{
bool HasInvalidations(Control c)
{
if (!c.IsMeasureValid)
return true;
for (var i = 0; i < c.VisualChildren.Count; ++i)
{
if (c.VisualChildren[i] is Control child)
{
if (!child.IsMeasureValid || HasInvalidations(child))
return true;
}
}
return false;
}
void Invalidate(Control c)
{
c.InvalidateMeasure();
for (var i = 0; i < c.VisualChildren.Count; ++i)
{
if (c.VisualChildren[i] is Control child)
Invalidate(child);
}
}
if (HasInvalidations(c))
Invalidate(c);
}
private void OnUnrealizedFocusedElementLostFocus(object? sender, RoutedEventArgs e) private void OnUnrealizedFocusedElementLostFocus(object? sender, RoutedEventArgs e)
{ {
if (_unrealizedFocusedElement is null || sender != _unrealizedFocusedElement) if (_unrealizedFocusedElement is null || sender != _unrealizedFocusedElement)

Loading…
Cancel
Save