From 657c53fb7303a2a5c877d84926ca2a0bc4c5f5a4 Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Thu, 23 Feb 2017 00:03:31 +0300 Subject: [PATCH] Make it clear that MaxClientSize is used when available --- src/Avalonia.Controls/Presenters/ItemVirtualizerSimple.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Avalonia.Controls/Presenters/ItemVirtualizerSimple.cs b/src/Avalonia.Controls/Presenters/ItemVirtualizerSimple.cs index 01111d7b54..96190720ae 100644 --- a/src/Avalonia.Controls/Presenters/ItemVirtualizerSimple.cs +++ b/src/Avalonia.Controls/Presenters/ItemVirtualizerSimple.cs @@ -97,11 +97,9 @@ namespace Avalonia.Controls.Presenters /// public override Size MeasureOverride(Size availableSize) { - var maxAvailableSize = (Owner.GetVisualRoot() as WindowBase)?.PlatformImpl?.MaxClientSize; - if (!maxAvailableSize.HasValue) - { - maxAvailableSize = (Owner.GetVisualRoot() as TopLevel)?.ClientSize; - } + var visualRoot = Owner.GetVisualRoot(); + var maxAvailableSize = (visualRoot as WindowBase)?.PlatformImpl?.MaxClientSize + ?? (visualRoot as TopLevel)?.ClientSize; // If infinity is passed as the available size and we're virtualized then we need to // fill the available space, but to do that we *don't* want to materialize all our