From 2ab8941426a5fa96e3ce0a4dc5cc2fc1d15c875a Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Wed, 7 Sep 2016 21:58:39 +0200 Subject: [PATCH] Move MaxClientSize to ITopLevelImpl. This allows the maximum size calculation constraint to be applied when an `ItemsPresenter` is in a `Popup`, meaning that all items don't get materialized when the popup is shown. Fixes #719, hopefully. --- src/Avalonia.Controls/Platform/ITopLevelImpl.cs | 5 +++++ src/Avalonia.Controls/Platform/IWindowImpl.cs | 5 ----- src/Avalonia.Controls/Presenters/ItemsPresenter.cs | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Avalonia.Controls/Platform/ITopLevelImpl.cs b/src/Avalonia.Controls/Platform/ITopLevelImpl.cs index f5d8344bda..b06c4b9695 100644 --- a/src/Avalonia.Controls/Platform/ITopLevelImpl.cs +++ b/src/Avalonia.Controls/Platform/ITopLevelImpl.cs @@ -22,6 +22,11 @@ namespace Avalonia.Platform /// Size ClientSize { get; set; } + /// + /// Gets the maximum size of a window on the system. + /// + Size MaxClientSize { get; } + /// /// Gets the scaling factor for the window. /// diff --git a/src/Avalonia.Controls/Platform/IWindowImpl.cs b/src/Avalonia.Controls/Platform/IWindowImpl.cs index 05a51d02aa..609e9834cb 100644 --- a/src/Avalonia.Controls/Platform/IWindowImpl.cs +++ b/src/Avalonia.Controls/Platform/IWindowImpl.cs @@ -11,11 +11,6 @@ namespace Avalonia.Platform /// public interface IWindowImpl : ITopLevelImpl { - /// - /// Gets the maximum size of a window on the system. - /// - Size MaxClientSize { get; } - /// /// Gets or sets the minimized/maximized state of the window. /// diff --git a/src/Avalonia.Controls/Presenters/ItemsPresenter.cs b/src/Avalonia.Controls/Presenters/ItemsPresenter.cs index 2e586a25e3..fa15766e4d 100644 --- a/src/Avalonia.Controls/Presenters/ItemsPresenter.cs +++ b/src/Avalonia.Controls/Presenters/ItemsPresenter.cs @@ -99,7 +99,7 @@ namespace Avalonia.Controls.Presenters // the available size. if (availableSize == Size.Infinity && VirtualizationMode != ItemVirtualizationMode.None) { - var window = VisualRoot as Window; + var window = VisualRoot as TopLevel; if (window != null) {