diff --git a/Terminal.Gui/ViewBase/View.cs b/Terminal.Gui/ViewBase/View.cs index 2061ef482..720f0d428 100644 --- a/Terminal.Gui/ViewBase/View.cs +++ b/Terminal.Gui/ViewBase/View.cs @@ -245,12 +245,13 @@ public partial class View : IDisposable, ISupportInitializeNotification } } - if (ApplicationImpl.Instance.IsLegacy) - { - // TODO: Figure out how to move this out of here and just depend on LayoutNeeded in Mainloop - Layout (); // the EventLog in AllViewsTester fails to layout correctly if this is not here (convoluted Dim.Fill(Func)). - } + // Force a layout each time a View is initialized + // See: https://github.com/gui-cs/Terminal.Gui/issues/3951 + // See: https://github.com/gui-cs/Terminal.Gui/issues/4204 + Layout (); // the EventLog in AllViewsTester fails to layout correctly if this is not here (convoluted Dim.Fill(Func)). + // Complex layout scenarios (e.g. DimAuto and PosAlign) may require multiple layouts to be performed. + // Thus, we call SetNeedsLayout() to ensure that the layout is performed at least once. SetNeedsLayout (); Initialized?.Invoke (this, EventArgs.Empty);