Tig 1 年之前
父节点
当前提交
aff87b0364
共有 35 个文件被更改,包括 344 次插入182 次删除
  1. 1 1
      Terminal.Gui/View/Layout/Dim.cs
  2. 5 2
      Terminal.Gui/View/Layout/DimAuto.cs
  3. 5 7
      Terminal.Gui/View/Layout/DimAutoStyle.cs
  4. 2 2
      Terminal.Gui/View/Layout/DimPercent.cs
  5. 1 1
      Terminal.Gui/View/Layout/DimPercentMode.cs
  6. 2 2
      Terminal.Gui/View/Layout/Pos.cs
  7. 14 14
      Terminal.Gui/View/Layout/ViewLayout.cs
  8. 111 47
      Terminal.Gui/View/ViewContent.cs
  9. 6 6
      Terminal.Gui/View/ViewDrawing.cs
  10. 9 9
      Terminal.Gui/View/ViewText.cs
  11. 6 6
      Terminal.Gui/View/ViewportSettings.cs
  12. 3 3
      Terminal.Gui/Views/ColorPicker.cs
  13. 2 2
      Terminal.Gui/Views/ComboBox.cs
  14. 1 1
      Terminal.Gui/Views/Menu/MenuBar.cs
  15. 1 1
      Terminal.Gui/Views/MessageBox.cs
  16. 19 19
      Terminal.Gui/Views/ScrollView.cs
  17. 1 1
      Terminal.Gui/Views/StatusBar.cs
  18. 1 1
      Terminal.Gui/Views/TabView.cs
  19. 3 2
      UICatalog/Scenarios/ASCIICustomButton.cs
  20. 2 1
      UICatalog/Scenarios/Clipping.cs
  21. 12 11
      UICatalog/Scenarios/ContentScrolling.cs
  22. 2 1
      UICatalog/Scenarios/Scrolling.cs
  23. 0 1
      UnitTests/UICatalog/ScenarioTests.cs
  24. 22 6
      UnitTests/View/Layout/Dim.AutoTests.cs
  25. 45 2
      UnitTests/View/Layout/ViewportTests.cs
  26. 42 1
      UnitTests/View/SubviewTests.cs
  27. 1 1
      UnitTests/View/TextTests.cs
  28. 1 1
      UnitTests/View/TitleTests.cs
  29. 2 2
      UnitTests/Views/ButtonTests.cs
  30. 6 6
      UnitTests/Views/ScrollViewTests.cs
  31. 1 1
      UnitTests/Views/SliderTests.cs
  32. 2 2
      docfx/docs/dimauto.md
  33. 7 13
      docfx/docs/layout.md
  34. 5 5
      docfx/docs/migratingfromv1.md
  35. 1 1
      docfx/docs/newinv2.md

+ 1 - 1
Terminal.Gui/View/Layout/Dim.cs

@@ -186,7 +186,7 @@ public abstract class Dim
     ///     Gets a dimension that is anchored to a certain point in the layout.
     ///     This method is typically used internally by the layout system to determine the size of a View.
     /// </summary>
-    /// <param name="size">The width of the area where the View is being sized (Superview.ContentSize).</param>
+    /// <param name="size">The width of the area where the View is being sized (Superview.GetContentSize ()).</param>
     /// <returns>
     ///     An integer representing the calculated dimension. The way this dimension is calculated depends on the specific
     ///     subclass of Dim that is used. For example, DimAbsolute returns a fixed dimension, DimFactor returns a

+ 5 - 2
Terminal.Gui/View/Layout/DimAuto.cs

@@ -69,12 +69,15 @@ public class DimAuto () : Dim
 
         if (Style.FastHasFlags (DimAutoStyle.Content))
         {
-            if (us._contentSize is { })
+            if (!us.ContentSizeTracksViewport)
             {
-                subviewsSize = dimension == Dimension.Width ? us.ContentSize.Width : us.ContentSize.Height;
+                // ContentSize was explicitly set. Ignore subviews.
+                subviewsSize = dimension == Dimension.Width ? us.GetContentSize ().Width : us.GetContentSize ().Height;
             }
             else
             {
+                // ContentSize was NOT explicitly set. Use subviews to determine size.
+
                 // TODO: This whole body of code is a WIP (for https://github.com/gui-cs/Terminal.Gui/pull/3451).
                 subviewsSize = 0;
 

+ 5 - 7
Terminal.Gui/View/Layout/DimAutoStyle.cs

@@ -10,11 +10,9 @@ namespace Terminal.Gui;
 public enum DimAutoStyle
 {
     /// <summary>
-    ///     The dimensions will be computed based on the View's non-Text content.
+    ///     The dimensions will be computed based on the View's <see cref="View.GetContentSize ()"/> and/or <see cref="View.Subviews"/>.
     ///     <para>
-    ///         If <see cref="View.ContentSize"/> is explicitly set (is not <see langword="null"/>) then
-    ///         <see cref="View.ContentSize"/>
-    ///         will be used to determine the dimension.
+    ///         If <see cref="View.GetContentSize ()TracksViewport"/> is <see langword="true"/>, <see cref="View.GetContentSize ()"/> will be used to determine the dimension.
     ///     </para>
     ///     <para>
     ///         Otherwise, the Subview in <see cref="View.Subviews"/> with the largest corresponding position plus dimension
@@ -33,14 +31,14 @@ public enum DimAutoStyle
     ///         will be used to determine the dimension.
     ///     </para>
     ///     <para>
-    ///         The corresponding dimensions of the <see cref="View.Subviews"/> will be ignored.
+    ///         The corresponding dimensions of <see cref="View.GetContentSize ()"/> and/or <see cref="View.Subviews"/> will be ignored.
     ///     </para>
     /// </summary>
     Text = 2,
 
     /// <summary>
-    ///     The dimension will be computed using both the view's <see cref="View.Text"/> and
-    ///     <see cref="View.Subviews"/> (whichever is larger).
+    ///     The dimension will be computed using the largest of the view's <see cref="View.Text"/>, <see cref="View.GetContentSize ()"/>, and
+    ///     <see cref="View.Subviews"/> corresponding dimension
     /// </summary>
     Auto = Content | Text,
 }

+ 2 - 2
Terminal.Gui/View/Layout/DimPercent.cs

@@ -11,7 +11,7 @@ namespace Terminal.Gui;
 /// <param name="percent">The percentage.</param>
 /// <param name="mode">
 ///     If <see cref="DimPercentMode.Position"/> the dimension is computed using the View's position (<see cref="View.X"/> or
-///     <see cref="View.Y"/>); otherwise, the dimension is computed using the View's <see cref="View.ContentSize"/>.
+///     <see cref="View.Y"/>); otherwise, the dimension is computed using the View's <see cref="View.GetContentSize ()"/>.
 /// </param>
 public class DimPercent (int percent, DimPercentMode mode = DimPercentMode.ContentSize) : Dim
 {
@@ -32,7 +32,7 @@ public class DimPercent (int percent, DimPercentMode mode = DimPercentMode.Conte
     public override string ToString () { return $"Percent({Percent},{Mode})"; }
 
     /// <summary>
-    ///     Gets whether the dimension is computed using the View's position or ContentSize.
+    ///     Gets whether the dimension is computed using the View's position or GetContentSize ().
     /// </summary>
     public DimPercentMode Mode { get; } = mode;
 

+ 1 - 1
Terminal.Gui/View/Layout/DimPercentMode.cs

@@ -15,7 +15,7 @@ public enum DimPercentMode
     Position = 0,
 
     /// <summary>
-    /// The dimension is computed using the View's <see cref="View.ContentSize"/>.
+    /// The dimension is computed using the View's <see cref="View.GetContentSize ()"/>.
     /// </summary>
     ContentSize = 1
 }

+ 2 - 2
Terminal.Gui/View/Layout/Pos.cs

@@ -296,12 +296,12 @@ public abstract class Pos
 
     /// <summary>
     ///     Gets the starting point of an element based on the size of the parent element (typically
-    ///     <c>Superview.ContentSize</c>).
+    ///     <c>Superview.GetContentSize ()</c>).
     ///     This method is meant to be overridden by subclasses to provide different ways of calculating the starting point.
     ///     This method is used
     ///     internally by the layout system to determine where a View should be positioned.
     /// </summary>
-    /// <param name="size">The size of the parent element (typically <c>Superview.ContentSize</c>).</param>
+    /// <param name="size">The size of the parent element (typically <c>Superview.GetContentSize ()</c>).</param>
     /// <returns>
     ///     An integer representing the calculated position. The way this position is calculated depends on the specific
     ///     subclass of Pos that is used. For example, PosAbsolute returns a fixed position, PosAnchorEnd returns a

+ 14 - 14
Terminal.Gui/View/Layout/ViewLayout.cs

@@ -12,10 +12,10 @@ public partial class View
     /// <summary>Gets or sets the absolute location and dimension of the view.</summary>
     /// <value>
     ///     The rectangle describing absolute location and dimension of the view, in coordinates relative to the
-    ///     <see cref="SuperView"/>'s Content, which is bound by <see cref="ContentSize"/>.
+    ///     <see cref="SuperView"/>'s Content, which is bound by <see cref="GetContentSize ()"/>.
     /// </value>
     /// <remarks>
-    ///     <para>Frame is relative to the <see cref="SuperView"/>'s Content, which is bound by <see cref="ContentSize"/>.</para>
+    ///     <para>Frame is relative to the <see cref="SuperView"/>'s Content, which is bound by <see cref="GetContentSize ()"/>.</para>
     ///     <para>
     ///         Setting Frame will set <see cref="X"/>, <see cref="Y"/>, <see cref="Width"/>, and <see cref="Height"/> to the
     ///         values of the corresponding properties of the <paramref name="value"/> parameter.
@@ -133,7 +133,7 @@ public partial class View
     /// <value>The <see cref="Pos"/> object representing the X position.</value>
     /// <remarks>
     ///     <para>
-    ///         The position is relative to the <see cref="SuperView"/>'s Content, which is bound by <see cref="ContentSize"/>.
+    ///         The position is relative to the <see cref="SuperView"/>'s Content, which is bound by <see cref="GetContentSize ()"/>.
     ///     </para>
     ///     <para>
     ///         If set to a relative value (e.g. <see cref="Pos.Center"/>) the value is indeterminate until the view has been
@@ -171,7 +171,7 @@ public partial class View
     /// <value>The <see cref="Pos"/> object representing the Y position.</value>
     /// <remarks>
     ///     <para>
-    ///         The position is relative to the <see cref="SuperView"/>'s Content, which is bound by <see cref="ContentSize"/>.
+    ///         The position is relative to the <see cref="SuperView"/>'s Content, which is bound by <see cref="GetContentSize ()"/>.
     ///     </para>
     ///     <para>
     ///         If set to a relative value (e.g. <see cref="Pos.Center"/>) the value is indeterminate until the view has been
@@ -208,7 +208,7 @@ public partial class View
     /// <value>The <see cref="Dim"/> object representing the height of the view (the number of rows).</value>
     /// <remarks>
     ///     <para>
-    ///         The dimension is relative to the <see cref="SuperView"/>'s Content, which is bound by <see cref="ContentSize"/>
+    ///         The dimension is relative to the <see cref="SuperView"/>'s Content, which is bound by <see cref="GetContentSize ()"/>
     ///         .
     ///     </para>
     ///     <para>
@@ -253,7 +253,7 @@ public partial class View
     /// <value>The <see cref="Dim"/> object representing the width of the view (the number of columns).</value>
     /// <remarks>
     ///     <para>
-    ///         The dimension is relative to the <see cref="SuperView"/>'s Content, which is bound by <see cref="ContentSize"/>
+    ///         The dimension is relative to the <see cref="SuperView"/>'s Content, which is bound by <see cref="GetContentSize ()"/>
     ///         .
     ///     </para>
     ///     <para>
@@ -570,7 +570,7 @@ public partial class View
 
         CheckDimAuto ();
 
-        var contentSize = ContentSize;
+        var contentSize = GetContentSize ();
         OnLayoutStarted (new (contentSize));
 
         LayoutAdornments ();
@@ -594,7 +594,7 @@ public partial class View
         {
             foreach ((View from, View to) in edges)
             {
-                LayoutSubview (to, from.ContentSize);
+                LayoutSubview (to, from.GetContentSize ());
             }
         }
 
@@ -647,8 +647,8 @@ public partial class View
         // Determine our container's ContentSize - 
         //  First try SuperView.Viewport, then Application.Top, then Driver.Viewport.
         //  Finally, if none of those are valid, use int.MaxValue (for Unit tests).
-        Size superViewContentSize = SuperView is { IsInitialized: true } ? SuperView.ContentSize :
-                           Application.Top is { } && Application.Top != this && Application.Top.IsInitialized ? Application.Top.ContentSize :
+        Size superViewContentSize = SuperView is { IsInitialized: true } ? SuperView.GetContentSize () :
+                           Application.Top is { } && Application.Top != this && Application.Top.IsInitialized ? Application.Top.GetContentSize () :
                            Application.Driver?.Screen.Size ?? new (int.MaxValue, int.MaxValue);
 
         SetTextFormatterSize ();
@@ -690,7 +690,7 @@ public partial class View
 
     /// <summary>
     ///     Adjusts <see cref="Frame"/> given the SuperView's ContentSize (nominally the same as
-    ///     <c>this.SuperView.ContentSize</c>)
+    ///     <c>this.SuperView.GetContentSize ()</c>)
     ///     and the position (<see cref="X"/>, <see cref="Y"/>) and dimension (<see cref="Width"/>, and
     ///     <see cref="Height"/>).
     /// </summary>
@@ -702,7 +702,7 @@ public partial class View
     ///     </para>
     /// </remarks>
     /// <param name="superviewContentSize">
-    ///     The size of the SuperView's content (nominally the same as <c>this.SuperView.ContentSize</c>).
+    ///     The size of the SuperView's content (nominally the same as <c>this.SuperView.GetContentSize ()</c>).
     /// </param>
     internal void SetRelativeLayout (Size superviewContentSize)
     {
@@ -986,13 +986,13 @@ public partial class View
         // Verify none of the subviews are using Dim objects that depend on the SuperView's dimensions.
         foreach (View view in Subviews)
         {
-            if (widthAuto is { } && widthAuto.Style.FastHasFlags (DimAutoStyle.Content) && _contentSize is null)
+            if (widthAuto is { } && widthAuto.Style.FastHasFlags (DimAutoStyle.Content) && ContentSizeTracksViewport)
             {
                 ThrowInvalid (view, view.Width, nameof (view.Width));
                 ThrowInvalid (view, view.X, nameof (view.X));
             }
 
-            if (heightAuto is { } && heightAuto.Style.FastHasFlags (DimAutoStyle.Content) && _contentSize is null)
+            if (heightAuto is { } && heightAuto.Style.FastHasFlags (DimAutoStyle.Content) && ContentSizeTracksViewport)
             {
                 ThrowInvalid (view, view.Height, nameof (view.Height));
                 ThrowInvalid (view, view.Y, nameof (view.Y));

+ 111 - 47
Terminal.Gui/View/ViewContent.cs

@@ -1,6 +1,4 @@
-using System.Diagnostics;
-
-namespace Terminal.Gui;
+namespace Terminal.Gui;
 
 public partial class View
 {
@@ -13,33 +11,31 @@ public partial class View
     /// </summary>
     /// <remarks>
     ///     <para>
-    ///         By default, the content size is set to <see langword="null"/>.
-    ///     </para>
-    /// </remarks>
-    /// <param name="contentSize">
-    ///     <para>
-    ///         If <see langword="null"/>, and the View has no visible subviews, <see cref="ContentSize"/> will track the size of <see cref="Viewport"/>.
+    ///         Negative sizes are not supported.
     ///     </para>
     ///     <para>
-    ///         If <see langword="null"/>, and the View has visible subviews, <see cref="ContentSize"/> will track the maximum position plus size of any
-    ///         visible Subviews
-    ///         and <c>Viewport.Location</c>  will track the minimum position and size of any visible Subviews.
+    ///         If not explicitly set, and the View has no visible subviews, <see cref="GetContentSize ()"/> will return the
+    ///         size of
+    ///         <see cref="Viewport"/>.
     ///     </para>
     ///     <para>
-    ///         If not <see langword="null"/>, <see cref="ContentSize"/> is set to the passed value and <see cref="Viewport"/> describes the portion of the content currently visible
-    ///         to the user. This enables virtual scrolling.
+    ///         If not explicitly set, and the View has visible subviews, <see cref="GetContentSize ()"/> will return the
+    ///         maximum
+    ///         position + dimension of the Subviews, supporting <see cref="Dim.Auto"/> with the
+    ///         <see cref="DimAutoStyle.Content"/> flag set.
     ///     </para>
     ///     <para>
-    ///         If not <see langword="null"/>, <see cref="ContentSize"/> is set to the passed value and the behavior of <see cref="DimAutoStyle.Content"/> will be to use the ContentSize
-    ///         to determine the size of the view.
+    ///         If set <see cref="Viewport"/> describes the portion of the content currently visible to the user. This enables
+    ///         virtual scrolling.
     ///     </para>
     ///     <para>
-    ///         Negative sizes are not supported.
+    ///         If set the behavior of <see cref="DimAutoStyle.Content"/> will be to use the ContentSize to determine the size
+    ///         of the view.
     ///     </para>
-    /// </param>
+    /// </remarks>
     public void SetContentSize (Size? contentSize)
     {
-        if (ContentSize.Width < 0 || ContentSize.Height < 0)
+        if (contentSize is { } && (contentSize.Value.Width < 0 || contentSize.Value.Height < 0))
         {
             throw new ArgumentException (@"ContentSize cannot be negative.", nameof (contentSize));
         }
@@ -56,19 +52,86 @@ public partial class View
     /// <summary>
     ///     Gets the size of the View's content.
     /// </summary>
-    /// <remarks>
+    /// <remarks>a>
     ///     <para>
-    ///         Use <see cref="SetContentSize"/> to change to change the content size.
+    ///         If the content size was not explicitly set by <see cref="SetContentSize"/>, and the View has no visible subviews, <see cref="GetContentSize ()"/> will return the
+    ///         size of
+    ///         <see cref="Viewport"/>.
     ///     </para>
     ///     <para>
-    ///         If the content size has not been explicitly set with <see cref="SetContentSize"/>, the value tracks
-    ///         <see cref="Viewport"/>.
+    ///         If the content size was not explicitly set by <see cref="SetContentSize"/>, and the View has visible subviews, <see cref="GetContentSize ()"/> will return the
+    ///         maximum
+    ///         position + dimension of the Subviews, supporting <see cref="Dim.Auto"/> with the
+    ///         <see cref="DimAutoStyle.Content"/> flag set.
+    ///     </para>
+    ///     <para>
+    ///         If set <see cref="Viewport"/> describes the portion of the content currently visible to the user. This enables
+    ///         virtual scrolling.
+    ///     </para>
+    ///     <para>
+    ///         If set the behavior of <see cref="DimAutoStyle.Content"/> will be to use the ContentSize to determine the size
+    ///         of the view.
     ///     </para>
     /// </remarks>
-    public Size ContentSize => _contentSize ?? Viewport.Size;
+    /// <returns>
+    ///     If the content size was not explicitly set by <see cref="SetContentSize"/>, <see cref="GetContentSize ()"/> will
+    ///     return the size of the <see cref="Viewport"/> and <see cref="ContentSizeTracksViewport"/> will be <see langword="true"/>.
+    /// </returns>
+    public Size GetContentSize () { return _contentSize ?? Viewport.Size; }
 
     /// <summary>
-    /// Called when <see cref="ContentSize"/> has changed.
+    ///     Gets or sets a value indicating whether the view's content size tracks the <see cref="Viewport"/>'s
+    ///     size or not.
+    /// </summary>
+    /// <remarks>
+    ///     <list type="bullet">
+    ///         <listheader>
+    ///             <term>Value</term> <description>Result</description>
+    ///         </listheader>
+    ///         <item>
+    ///             <term>
+    ///                 <see langword="true"/>
+    ///             </term>
+    ///             <description>
+    ///                 <para>
+    ///                     <see cref="GetContentSize ()"/> will return the <see cref="Viewport"/>'s size. Content scrolling
+    ///                     will be
+    ///                     disabled.
+    ///                 </para>
+    ///                 <para>
+    ///                     The behavior of <see cref="DimAutoStyle.Content"/> will be to use position and size of the Subviews
+    ///                     to
+    ///                     determine the size of the view, ignoring <see cref="GetContentSize ()"/>.
+    ///                 </para>
+    ///             </description>
+    ///         </item>
+    ///         <item>
+    ///             <term>
+    ///                 <see langword="false"/>
+    ///             </term>
+    ///             <description>
+    ///                 <para>
+    ///                     The return value of <see cref="GetContentSize ()"/> is independent of <see cref="Viewport"/> and <see cref="Viewport"/>
+    ///                     describes the portion of the content currently visible to the user enabling content scrolling.
+    ///                 </para>
+    ///                 <para>
+    ///                     The behavior of <see cref="DimAutoStyle.Content"/> will be to use <see cref="GetContentSize ()"/>
+    ///                     to
+    ///                     determine the
+    ///                     size of the view, ignoring the position and size of the Subviews.
+    ///                 </para>
+    ///             </description>
+    ///         </item>
+    ///     </list>
+    /// </remarks>
+    public bool ContentSizeTracksViewport
+    {
+        get => _contentSize is null;
+        set => _contentSize = value ? null : _contentSize;
+    }
+
+    /// <summary>
+    ///     Called when <see cref="GetContentSize ()"/> has changed.
     /// </summary>
     /// <param name="e"></param>
     /// <returns></returns>
@@ -79,6 +142,7 @@ public partial class View
         if (e.Cancel != true)
         {
             OnResizeNeeded ();
+
             //SetNeedsLayout ();
             //SetNeedsDisplay ();
         }
@@ -87,7 +151,7 @@ public partial class View
     }
 
     /// <summary>
-    ///     Event raised when the <see cref="ContentSize"/> changes.
+    ///     Event raised when the <see cref="GetContentSize ()"/> changes.
     /// </summary>
     public event EventHandler<SizeChangedEventArgs> ContentSizeChanged;
 
@@ -155,32 +219,35 @@ public partial class View
     /// <summary>
     ///     The location of the viewport into the view's content (0,0) is the top-left corner of the content. The Content
     ///     area's size
-    ///     is <see cref="ContentSize"/>.
+    ///     is <see cref="GetContentSize ()"/>.
     /// </summary>
     private Point _viewportLocation;
 
     /// <summary>
     ///     Gets or sets the rectangle describing the portion of the View's content that is visible to the user.
     ///     The viewport Location is relative to the top-left corner of the inner rectangle of <see cref="Padding"/>.
-    ///     If the viewport Size is the same as <see cref="ContentSize"/>, or <see cref="ContentSize"/> is
+    ///     If the viewport Size is the same as <see cref="GetContentSize ()"/>, or <see cref="GetContentSize ()"/> is
     ///     <see langword="null"/> the Location will be <c>0, 0</c>.
     /// </summary>
     /// <value>
     ///     The rectangle describing the location and size of the viewport into the View's virtual content, described by
-    ///     <see cref="ContentSize"/>.
+    ///     <see cref="GetContentSize ()"/>.
     /// </value>
     /// <remarks>
     ///     <para>
     ///         Positive values for the location indicate the visible area is offset into (down-and-right) the View's virtual
-    ///         <see cref="ContentSize"/>. This enables scrolling down and to the right (e.g. in a <see cref="ListView"/>.
+    ///         <see cref="GetContentSize ()"/>. This enables scrolling down and to the right (e.g. in a <see cref="ListView"/>
+    ///         .
     ///     </para>
     ///     <para>
     ///         Negative values for the location indicate the visible area is offset above (up-and-left) the View's virtual
-    ///         <see cref="ContentSize"/>. This enables scrolling up and to the left (e.g. in an image viewer that supports zoom
+    ///         <see cref="GetContentSize ()"/>. This enables scrolling up and to the left (e.g. in an image viewer that
+    ///         supports
+    ///         zoom
     ///         where the image stays centered).
     ///     </para>
     ///     <para>
-    ///         The <see cref="ViewportSettings"/> property controls how scrolling is handled. 
+    ///         The <see cref="ViewportSettings"/> property controls how scrolling is handled.
     ///     </para>
     ///     <para>
     ///         Updates to the Viewport Size updates <see cref="Frame"/>, and has the same impact as updating the
@@ -202,6 +269,7 @@ public partial class View
             }
 
             Thickness thickness = GetAdornmentsThickness ();
+
             return new (
                         _viewportLocation,
                         new (
@@ -234,6 +302,7 @@ public partial class View
             }
 
             OnViewportChanged (new (IsInitialized ? Viewport : Rectangle.Empty, oldViewport));
+
             return;
         }
 
@@ -249,9 +318,9 @@ public partial class View
         {
             if (!ViewportSettings.HasFlag (ViewportSettings.AllowXGreaterThanContentWidth))
             {
-                if (newViewport.X >= ContentSize.Width)
+                if (newViewport.X >= GetContentSize ().Width)
                 {
-                    newViewport.X = ContentSize.Width - 1;
+                    newViewport.X = GetContentSize ().Width - 1;
                 }
             }
 
@@ -266,9 +335,9 @@ public partial class View
 
             if (!ViewportSettings.HasFlag (ViewportSettings.AllowYGreaterThanContentHeight))
             {
-                if (newViewport.Y >= ContentSize.Height)
+                if (newViewport.Y >= GetContentSize ().Height)
                 {
-                    newViewport.Y = ContentSize.Height - 1;
+                    newViewport.Y = GetContentSize ().Height - 1;
                 }
             }
 
@@ -284,7 +353,8 @@ public partial class View
     }
 
     /// <summary>
-    ///     Fired when the <see cref="Viewport"/> changes. This event is fired after the <see cref="Viewport"/> has been updated.
+    ///     Fired when the <see cref="Viewport"/> changes. This event is fired after the <see cref="Viewport"/> has been
+    ///     updated.
     /// </summary>
     [CanBeNull]
     public event EventHandler<DrawEventArgs> ViewportChanged;
@@ -293,10 +363,7 @@ public partial class View
     ///     Called when the <see cref="Viewport"/> changes. Invokes the <see cref="ViewportChanged"/> event.
     /// </summary>
     /// <param name="e"></param>
-    protected virtual void OnViewportChanged (DrawEventArgs e)
-    {
-        ViewportChanged?.Invoke (this, e);
-    }
+    protected virtual void OnViewportChanged (DrawEventArgs e) { ViewportChanged?.Invoke (this, e); }
 
     /// <summary>
     ///     Converts a <see cref="Viewport"/>-relative location and size to a screen-relative location and size.
@@ -306,10 +373,7 @@ public partial class View
     /// </remarks>
     /// <param name="viewport">Viewport-relative location and size.</param>
     /// <returns>Screen-relative location and size.</returns>
-    public Rectangle ViewportToScreen (in Rectangle viewport)
-    {
-        return viewport with { Location = ViewportToScreen (viewport.Location) };
-    }
+    public Rectangle ViewportToScreen (in Rectangle viewport) { return viewport with { Location = ViewportToScreen (viewport.Location) }; }
 
     /// <summary>
     ///     Converts a <see cref="Viewport"/>-relative location to a screen-relative location.
@@ -362,7 +426,7 @@ public partial class View
     /// <returns><see langword="true"/> if the <see cref="Viewport"/> was changed.</returns>
     public bool? ScrollVertical (int rows)
     {
-        if (ContentSize == Size.Empty || ContentSize == Viewport.Size)
+        if (GetContentSize () == Size.Empty || GetContentSize () == Viewport.Size)
         {
             return false;
         }
@@ -383,7 +447,7 @@ public partial class View
     /// <returns><see langword="true"/> if the <see cref="Viewport"/> was changed.</returns>
     public bool? ScrollHorizontal (int cols)
     {
-        if (ContentSize == Size.Empty || ContentSize == Viewport.Size)
+        if (GetContentSize () == Size.Empty || GetContentSize () == Viewport.Size)
         {
             return false;
         }

+ 6 - 6
Terminal.Gui/View/ViewDrawing.cs

@@ -106,7 +106,7 @@ public partial class View
 
         if (ViewportSettings.HasFlag (ViewportSettings.ClearContentOnly))
         {
-            Rectangle visibleContent = ViewportToScreen (new Rectangle (new (-Viewport.X, -Viewport.Y), ContentSize));
+            Rectangle visibleContent = ViewportToScreen (new Rectangle (new (-Viewport.X, -Viewport.Y), GetContentSize ()));
             toClear = Rectangle.Intersect (toClear, visibleContent);
         }
 
@@ -172,7 +172,7 @@ public partial class View
         if (ViewportSettings.HasFlag (ViewportSettings.ClipContentOnly))
         {
             // Clamp the Clip to the just content area that is within the viewport
-            Rectangle visibleContent = ViewportToScreen (new Rectangle (new (-Viewport.X, -Viewport.Y), ContentSize));
+            Rectangle visibleContent = ViewportToScreen (new Rectangle (new (-Viewport.X, -Viewport.Y), GetContentSize ()));
             clip = Rectangle.Intersect (clip, visibleContent);
         }
 
@@ -445,12 +445,12 @@ public partial class View
     ///     </para>
     ///     <para>
     ///         The <see cref="Viewport"/> Location and Size indicate what part of the View's content, defined
-    ///         by <see cref="ContentSize"/>, is visible and should be drawn. The coordinates taken by <see cref="Move"/> and
+    ///         by <see cref="GetContentSize ()"/>, is visible and should be drawn. The coordinates taken by <see cref="Move"/> and
     ///         <see cref="AddRune"/> are relative to <see cref="Viewport"/>, thus if <c>ViewPort.Location.Y</c> is <c>5</c>
     ///         the 6th row of the content should be drawn using <c>MoveTo (x, 5)</c>.
     ///     </para>
     ///     <para>
-    ///         If <see cref="ContentSize"/> is larger than <c>ViewPort.Size</c> drawing code should use <see cref="Viewport"/>
+    ///         If <see cref="GetContentSize ()"/> is larger than <c>ViewPort.Size</c> drawing code should use <see cref="Viewport"/>
     ///         to constrain drawing for better performance.
     ///     </para>
     ///     <para>
@@ -485,7 +485,7 @@ public partial class View
 
             // This should NOT clear 
             // TODO: If the output is not in the Viewport, do nothing
-            var drawRect = new Rectangle (ContentToScreen (Point.Empty), ContentSize);
+            var drawRect = new Rectangle (ContentToScreen (Point.Empty), GetContentSize ());
 
             TextFormatter?.Draw (
                                  drawRect,
@@ -594,7 +594,7 @@ public partial class View
     /// <remarks>
     ///     <para>
     ///         The location of <paramref name="region"/> is relative to the View's content, bound by <c>Size.Empty</c> and
-    ///         <see cref="ContentSize"/>.
+    ///         <see cref="GetContentSize ()"/>.
     ///     </para>
     ///     <para>
     ///         If the view has not been initialized (<see cref="IsInitialized"/> is <see langword="false"/>), the area to be

+ 9 - 9
Terminal.Gui/View/ViewText.cs

@@ -37,11 +37,11 @@ public partial class View
     ///         to <see cref="TextAlignment"/> and <see cref="TextDirection"/>.
     ///     </para>
     ///     <para>
-    ///         The text will word-wrap to additional lines if it does not fit horizontally. If <see cref="ContentSize"/>'s height
+    ///         The text will word-wrap to additional lines if it does not fit horizontally. If <see cref="GetContentSize ()"/>'s height
     ///         is 1, the text will be clipped.
     ///     </para>
     ///     <para>If <see cref="View.Width"/> or <see cref="View.Height"/> are using <see cref="DimAutoStyle.Text"/>,
-    ///     the <see cref="ContentSize"/> will be adjusted to fit the text.</para>
+    ///     the <see cref="GetContentSize ()"/> will be adjusted to fit the text.</para>
     ///     <para>When the text changes, the <see cref="TextChanged"/> is fired.</para>
     /// </remarks>
     public virtual string Text
@@ -84,7 +84,7 @@ public partial class View
     ///     redisplay the <see cref="View"/>.
     /// </summary>
     /// <remarks>
-    ///     <para> <see cref="View.Width"/> or <see cref="View.Height"/> are using <see cref="DimAutoStyle.Text"/>, the <see cref="ContentSize"/> will be adjusted to fit the text.</para>
+    ///     <para> <see cref="View.Width"/> or <see cref="View.Height"/> are using <see cref="DimAutoStyle.Text"/>, the <see cref="GetContentSize ()"/> will be adjusted to fit the text.</para>
     /// </remarks>
     /// <value>The text alignment.</value>
     public virtual Alignment TextAlignment
@@ -103,7 +103,7 @@ public partial class View
     ///     <see cref="View"/>.
     /// </summary>
     /// <remarks>
-    ///     <para> <see cref="View.Width"/> or <see cref="View.Height"/> are using <see cref="DimAutoStyle.Text"/>, the <see cref="ContentSize"/> will be adjusted to fit the text.</para>
+    ///     <para> <see cref="View.Width"/> or <see cref="View.Height"/> are using <see cref="DimAutoStyle.Text"/>, the <see cref="GetContentSize ()"/> will be adjusted to fit the text.</para>
     /// </remarks>
     /// <value>The text direction.</value>
     public virtual TextDirection TextDirection
@@ -127,7 +127,7 @@ public partial class View
     ///     the <see cref="View"/>.
     /// </summary>
     /// <remarks>
-    ///     <para> <see cref="View.Width"/> or <see cref="View.Height"/> are using <see cref="DimAutoStyle.Text"/>, the <see cref="ContentSize"/> will be adjusted to fit the text.</para>
+    ///     <para> <see cref="View.Width"/> or <see cref="View.Height"/> are using <see cref="DimAutoStyle.Text"/>, the <see cref="GetContentSize ()"/> will be adjusted to fit the text.</para>
     /// </remarks>
     /// <value>The vertical text alignment.</value>
     public virtual Alignment VerticalTextAlignment
@@ -179,8 +179,8 @@ public partial class View
         // We need to ensure TextFormatter is accurate by calling it here.
         UpdateTextFormatterText ();
 
-        // Default is to use ContentSize.
-        var size = ContentSize;
+        // Default is to use GetContentSize ().
+        var size = GetContentSize ();
 
         // TODO: This is a hack. Figure out how to move this into DimDimAuto
         // Use _width & _height instead of Width & Height to avoid debug spew
@@ -193,12 +193,12 @@ public partial class View
 
             if (widthAuto is null || !widthAuto.Style.FastHasFlags (DimAutoStyle.Text))
             {
-                size.Width = ContentSize.Width;
+                size.Width = GetContentSize ().Width;
             }
 
             if (heightAuto is null || !heightAuto.Style.FastHasFlags (DimAutoStyle.Text))
             {
-                size.Height = ContentSize.Height;
+                size.Height = GetContentSize ().Height;
             }
         }
 

+ 6 - 6
Terminal.Gui/View/ViewportSettings.cs

@@ -47,13 +47,13 @@ public enum ViewportSettings
     AllowNegativeLocation = AllowNegativeX | AllowNegativeY,
 
     /// <summary>
-    ///     If set, <see cref="View.Viewport"/><c>.X</c> can be set values greater than <see cref="View.ContentSize"/>
+    ///     If set, <see cref="View.Viewport"/><c>.X</c> can be set values greater than <see cref="View.GetContentSize ()"/>
     ///     <c>.Width</c> enabling scrolling beyond the right
     ///     of the content area.
     /// </summary>
     /// <remarks>
     ///     <para>
-    ///         When not set, <see cref="View.Viewport"/><c>.X</c> is constrained to <see cref="View.ContentSize"/>
+    ///         When not set, <see cref="View.Viewport"/><c>.X</c> is constrained to <see cref="View.GetContentSize ()"/>
     ///         <c>.Width - 1</c>.
     ///         This means the last column of the content will remain visible even if there is an attempt to scroll the
     ///         Viewport past the last column.
@@ -65,13 +65,13 @@ public enum ViewportSettings
     AllowXGreaterThanContentWidth = 4,
 
     /// <summary>
-    ///     If set, <see cref="View.Viewport"/><c>.Y</c> can be set values greater than <see cref="View.ContentSize"/>
+    ///     If set, <see cref="View.Viewport"/><c>.Y</c> can be set values greater than <see cref="View.GetContentSize ()"/>
     ///     <c>.Height</c> enabling scrolling beyond the right
     ///     of the content area.
     /// </summary>
     /// <remarks>
     ///     <para>
-    ///         When not set, <see cref="View.Viewport"/><c>.Y</c> is constrained to <see cref="View.ContentSize"/>
+    ///         When not set, <see cref="View.Viewport"/><c>.Y</c> is constrained to <see cref="View.GetContentSize ()"/>
     ///         <c>.Height - 1</c>.
     ///         This means the last row of the content will remain visible even if there is an attempt to scroll the Viewport
     ///         past the last row.
@@ -83,13 +83,13 @@ public enum ViewportSettings
     AllowYGreaterThanContentHeight = 8,
 
     /// <summary>
-    ///     If set, <see cref="View.Viewport"/><c>.Size</c> can be set values greater than <see cref="View.ContentSize"/>
+    ///     If set, <see cref="View.Viewport"/><c>.Size</c> can be set values greater than <see cref="View.GetContentSize ()"/>
     ///     enabling scrolling beyond the bottom-right
     ///     of the content area.
     /// </summary>
     /// <remarks>
     ///     <para>
-    ///         When not set, <see cref="View.Viewport"/> is constrained to <see cref="View.ContentSize"/><c> -1</c>.
+    ///         When not set, <see cref="View.Viewport"/> is constrained to <see cref="View.GetContentSize ()"/><c> -1</c>.
     ///         This means the last column and row of the content will remain visible even if there is an attempt to
     ///         scroll the Viewport past the last column or row.
     ///     </para>

+ 3 - 3
Terminal.Gui/Views/ColorPicker.cs

@@ -39,7 +39,7 @@ public class ColorPicker : View
 
         Width = Dim.Auto (minimumContentDim: _boxWidth * _cols);
         Height = Dim.Auto (minimumContentDim: _boxHeight * _rows);
-        SetContentSize(new (_boxWidth * _cols, _boxHeight * _rows));
+        SetContentSize (new (_boxWidth * _cols, _boxHeight * _rows));
 
         MouseClick += ColorPicker_MouseClick;
     }
@@ -178,9 +178,9 @@ public class ColorPicker : View
         Driver.SetAttribute (HasFocus ? ColorScheme.Focus : GetNormalColor ());
         var colorIndex = 0;
 
-        for (var y = 0; y < Math.Max(2, viewport.Height / BoxHeight); y++)
+        for (var y = 0; y < Math.Max (2, viewport.Height / BoxHeight); y++)
         {
-            for (var x = 0; x < Math.Max(8, viewport.Width / BoxWidth); x++)
+            for (var x = 0; x < Math.Max (8, viewport.Width / BoxWidth); x++)
             {
                 int foregroundColorIndex = y == 0 ? colorIndex + _cols : colorIndex - _cols;
                 Driver.SetAttribute (new Attribute ((ColorName)foregroundColorIndex, (ColorName)colorIndex));

+ 2 - 2
Terminal.Gui/Views/ComboBox.cs

@@ -619,8 +619,8 @@ public class ComboBox : View
         {
             _search.Width = _listview.Width = _autoHide ? Viewport.Width - 1 : Viewport.Width;
             _listview.Height = CalculatetHeight ();
-            _search.SetRelativeLayout (ContentSize);
-            _listview.SetRelativeLayout (ContentSize);
+            _search.SetRelativeLayout (GetContentSize ());
+            _listview.SetRelativeLayout (GetContentSize ());
         }
     }
 

+ 1 - 1
Terminal.Gui/Views/Menu/MenuBar.cs

@@ -256,7 +256,7 @@ public class MenuBar : View
         X = 0;
         Y = 0;
         Width = Dim.Fill ();
-        Height = 1; // BUGBUG: Views should avoid setting Height as doing so implies Frame.Size == ContentSize
+        Height = 1; // BUGBUG: Views should avoid setting Height as doing so implies Frame.Size == GetContentSize ().
         Menus = new MenuBarItem [] { };
 
         //CanFocus = true;

+ 1 - 1
Terminal.Gui/Views/MessageBox.cs

@@ -405,7 +405,7 @@ public static class MessageBox
             Size GetWrapSize ()
             {
                 // A bit of a hack to get the height of the wrapped text.
-                messageLabel.TextFormatter.Size = d.ContentSize with { Height = 1000 };
+                messageLabel.TextFormatter.Size = d.GetContentSize () with { Height = 1000 };
                 return messageLabel.TextFormatter.FormatAndGetSize ();
             }
         }

+ 19 - 19
Terminal.Gui/Views/ScrollView.cs

@@ -21,7 +21,7 @@ namespace Terminal.Gui;
 ///     <para>
 ///         The subviews that are added to this <see cref="Gui.ScrollView"/> are offset by the
 ///         <see cref="ContentOffset"/> property.  The view itself is a window into the space represented by the
-///         <see cref="View.ContentSize"/>.
+///         <see cref="View.GetContentSize ()"/>.
 ///     </para>
 ///     <para>Use the</para>
 /// </remarks>
@@ -87,10 +87,10 @@ public class ScrollView : View
         AddCommand (Command.PageDown, () => ScrollDown (Viewport.Height));
         AddCommand (Command.PageLeft, () => ScrollLeft (Viewport.Width));
         AddCommand (Command.PageRight, () => ScrollRight (Viewport.Width));
-        AddCommand (Command.TopHome, () => ScrollUp (ContentSize.Height));
-        AddCommand (Command.BottomEnd, () => ScrollDown (ContentSize.Height));
-        AddCommand (Command.LeftHome, () => ScrollLeft (ContentSize.Width));
-        AddCommand (Command.RightEnd, () => ScrollRight (ContentSize.Width));
+        AddCommand (Command.TopHome, () => ScrollUp (GetContentSize ().Height));
+        AddCommand (Command.BottomEnd, () => ScrollDown (GetContentSize ().Height));
+        AddCommand (Command.LeftHome, () => ScrollLeft (GetContentSize ().Width));
+        AddCommand (Command.RightEnd, () => ScrollRight (GetContentSize ().Width));
 
         // Default keybindings for this view
         KeyBindings.Add (Key.CursorUp, Command.ScrollUp);
@@ -126,7 +126,7 @@ public class ScrollView : View
                            }
 
                            SetContentOffset (_contentOffset);
-                           _contentView.Frame = new Rectangle (ContentOffset, ContentSize);
+                           _contentView.Frame = new Rectangle (ContentOffset, GetContentSize ());
 
                            // PERF: How about calls to Point.Offset instead?
                            _vertical.ChangedPosition += delegate { ContentOffset = new Point (ContentOffset.X, _vertical.Position); };
@@ -219,12 +219,12 @@ public class ScrollView : View
     //    get => ContentSize;
     //    set
     //    {
-    //        if (ContentSize != value)
+    //        if (GetContentSize () != value)
     //        {
     //            ContentSize = value;
     //            _contentView.Frame = new Rectangle (_contentOffset, value);
-    //            _vertical.Size = ContentSize.Height;
-    //            _horizontal.Size = ContentSize.Width;
+    //            _vertical.Size = GetContentSize ().Height;
+    //            _horizontal.Size = GetContentSize ().Width;
     //            SetNeedsDisplay ();
     //        }
     //    }
@@ -243,26 +243,26 @@ public class ScrollView : View
                 _horizontal.OtherScrollBarView.KeepContentAlwaysInViewport = value;
                 Point p = default;
 
-                if (value && -_contentOffset.X + Viewport.Width > ContentSize.Width)
+                if (value && -_contentOffset.X + Viewport.Width > GetContentSize ().Width)
                 {
                     p = new Point (
-                                   ContentSize.Width - Viewport.Width + (_showVerticalScrollIndicator ? 1 : 0),
+                                   GetContentSize ().Width - Viewport.Width + (_showVerticalScrollIndicator ? 1 : 0),
                                    -_contentOffset.Y
                                   );
                 }
 
-                if (value && -_contentOffset.Y + Viewport.Height > ContentSize.Height)
+                if (value && -_contentOffset.Y + Viewport.Height > GetContentSize ().Height)
                 {
                     if (p == default (Point))
                     {
                         p = new Point (
                                        -_contentOffset.X,
-                                       ContentSize.Height - Viewport.Height + (_showHorizontalScrollIndicator ? 1 : 0)
+                                       GetContentSize ().Height - Viewport.Height + (_showHorizontalScrollIndicator ? 1 : 0)
                                       );
                     }
                     else
                     {
-                        p.Y = ContentSize.Height - Viewport.Height + (_showHorizontalScrollIndicator ? 1 : 0);
+                        p.Y = GetContentSize ().Height - Viewport.Height + (_showHorizontalScrollIndicator ? 1 : 0);
                     }
                 }
 
@@ -606,7 +606,7 @@ public class ScrollView : View
     {
         // INTENT: Unclear intent. How about a call to Offset?
         _contentOffset = new Point (-Math.Abs (offset.X), -Math.Abs (offset.Y));
-        _contentView.Frame = new Rectangle (_contentOffset, ContentSize);
+        _contentView.Frame = new Rectangle (_contentOffset, GetContentSize ());
         int p = Math.Max (0, -_contentOffset.Y);
 
         if (_vertical.Position != p)
@@ -637,7 +637,7 @@ public class ScrollView : View
         bool v = false, h = false;
         var p = false;
 
-        if (ContentSize is { } && (Viewport.Height == 0 || Viewport.Height > ContentSize.Height))
+        if (GetContentSize () is { } && (Viewport.Height == 0 || Viewport.Height > GetContentSize ().Height))
         {
             if (ShowVerticalScrollIndicator)
             {
@@ -646,7 +646,7 @@ public class ScrollView : View
 
             v = false;
         }
-        else if (ContentSize is { } && Viewport.Height > 0 && Viewport.Height == ContentSize.Height)
+        else if (GetContentSize () is { } && Viewport.Height > 0 && Viewport.Height == GetContentSize ().Height)
         {
             p = true;
         }
@@ -660,7 +660,7 @@ public class ScrollView : View
             v = true;
         }
 
-        if (ContentSize is { } && (Viewport.Width == 0 || Viewport.Width > ContentSize.Width))
+        if (GetContentSize () is { } && (Viewport.Width == 0 || Viewport.Width > GetContentSize ().Width))
         {
             if (ShowHorizontalScrollIndicator)
             {
@@ -669,7 +669,7 @@ public class ScrollView : View
 
             h = false;
         }
-        else if (ContentSize is { } && Viewport.Width > 0 && Viewport.Width == ContentSize.Width && p)
+        else if (GetContentSize () is { } && Viewport.Width > 0 && Viewport.Width == GetContentSize ().Width && p)
         {
             if (ShowHorizontalScrollIndicator)
             {

+ 1 - 1
Terminal.Gui/Views/StatusBar.cs

@@ -93,7 +93,7 @@ public class StatusBar : View
         X = 0;
         Y = Pos.AnchorEnd (1);
         Width = Dim.Fill ();
-        Height = 1; // BUGBUG: Views should avoid setting Height as doing so implies Frame.Size == ContentSize
+        Height = 1; // BUGBUG: Views should avoid setting Height as doing so implies Frame.Size == GetContentSize ().
         AddCommand (Command.Accept, InvokeItem);
     }
 

+ 1 - 1
Terminal.Gui/Views/TabView.cs

@@ -564,7 +564,7 @@ public class TabView : View
             _host = host;
 
             CanFocus = true;
-            Height = 1; // BUGBUG: Views should avoid setting Height as doing so implies Frame.Size == ContentSize
+            Height = 1; // BUGBUG: Views should avoid setting Height as doing so implies Frame.Size == GetContentSize ().
             Width = Dim.Fill ();
 
             _rightScrollIndicator = new View

+ 3 - 2
UICatalog/Scenarios/ASCIICustomButton.cs

@@ -235,6 +235,7 @@ public class ASCIICustomButtonTest : Scenario
                 pages++;
             }
 
+            // BUGBUG: set_ContentSize is supposed to be `protected`. 
             _scrollView.SetContentSize (new (25, pages * BUTTONS_ON_PAGE * BUTTON_HEIGHT));
 
             if (_smallerWindow)
@@ -269,7 +270,7 @@ public class ASCIICustomButtonTest : Scenario
                 case KeyCode.End:
                     _scrollView.ContentOffset = new Point (
                                                            _scrollView.ContentOffset.X,
-                                                           -(_scrollView.ContentSize.Height
+                                                           -(_scrollView.GetContentSize ().Height
                                                              - _scrollView.Frame.Height
                                                              + (_scrollView.ShowHorizontalScrollIndicator ? 1 : 0))
                                                           );
@@ -287,7 +288,7 @@ public class ASCIICustomButtonTest : Scenario
                                                            Math.Max (
                                                                      _scrollView.ContentOffset.Y
                                                                      - _scrollView.Frame.Height,
-                                                                     -(_scrollView.ContentSize.Height
+                                                                     -(_scrollView.GetContentSize ().Height
                                                                        - _scrollView.Frame.Height
                                                                        + (_scrollView.ShowHorizontalScrollIndicator
                                                                               ? 1

+ 2 - 1
UICatalog/Scenarios/Clipping.cs

@@ -23,12 +23,13 @@ public class Clipping : Scenario
         //Win.Height = Dim.Fill () - 2;
         var label = new Label
         {
-            X = 0, Y = 0, Text = "ScrollView (new Rectangle (3, 3, 50, 20)) with a 200, 100 ContentSize..."
+            X = 0, Y = 0, Text = "ScrollView (new Rectangle (3, 3, 50, 20)) with a 200, 100 GetContentSize ()..."
         };
         Top.Add (label);
 
         var scrollView = new ScrollView { X = 3, Y = 3, Width = 50, Height = 20 };
         scrollView.ColorScheme = Colors.ColorSchemes ["Menu"];
+        // BUGBUG: set_ContentSize is supposed to be `protected`. 
         scrollView.SetContentSize (new (200, 100));
 
         //ContentOffset = Point.Empty,

+ 12 - 11
UICatalog/Scenarios/ContentScrolling.cs

@@ -1,10 +1,11 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
 using System.Linq;
 using Terminal.Gui;
 
 namespace UICatalog.Scenarios;
 
-[ScenarioMetadata ("Content Scrolling", "Demonstrates using View.Viewport and View.ContentSize to scroll content.")]
+[ScenarioMetadata ("Content Scrolling", "Demonstrates using View.Viewport and View.GetContentSize () to scroll content.")]
 [ScenarioCategory ("Layout")]
 [ScenarioCategory ("Drawing")]
 [ScenarioCategory ("Scrolling")]
@@ -86,7 +87,7 @@ public class ContentScrolling : Scenario
 
             if (status is { })
             {
-                status.Title = $"Frame: {Frame}\n\nViewport: {Viewport}, ContentSize = {ContentSize}";
+                status.Title = $"Frame: {Frame}\n\nViewport: {Viewport}, ContentSize = {GetContentSize ()}";
                 status.Width = Border.Frame.Width - status.Frame.X - Border.Thickness.Right;
                 status.Height = Border.Thickness.Top;
             }
@@ -230,7 +231,7 @@ public class ContentScrolling : Scenario
 
         Buttons.NumericUpDown<int> contentSizeWidth = new Buttons.NumericUpDown<int>
         {
-            Value = view.ContentSize.Width,
+            Value = view.GetContentSize ().Width,
             X = Pos.Right (labelContentSize) + 1,
             Y = Pos.Top (labelContentSize)
         };
@@ -244,8 +245,8 @@ public class ContentScrolling : Scenario
 
                 return;
             }
-
-            view.SetContentSize (view.ContentSize with { Width = e.NewValue });
+            // BUGBUG: set_ContentSize is supposed to be `protected`. 
+            view.SetContentSize (view.GetContentSize () with { Width = e.NewValue });
         }
 
         var labelComma = new Label
@@ -257,7 +258,7 @@ public class ContentScrolling : Scenario
 
         Buttons.NumericUpDown<int> contentSizeHeight = new Buttons.NumericUpDown<int>
         {
-            Value = view.ContentSize.Height,
+            Value = view.GetContentSize ().Height,
             X = Pos.Right (labelComma) + 1,
             Y = Pos.Top (labelContentSize),
             CanFocus = false
@@ -272,8 +273,8 @@ public class ContentScrolling : Scenario
 
                 return;
             }
-
-            view.SetContentSize (view.ContentSize with { Height = e.NewValue });
+            // BUGBUG: set_ContentSize is supposed to be `protected`. 
+            view.SetContentSize (view.GetContentSize () with { Height = e.NewValue });
         }
 
         var cbClearOnlyVisible = new CheckBox
@@ -355,8 +356,8 @@ public class ContentScrolling : Scenario
         {
             X = Pos.Center (),
             Y = Pos.Bottom (textView) + 1,
-            Width = Dim.Auto(DimAutoStyle.Content, maximumContentDim: Dim.Func (() => view.ContentSize.Width)),
-            Height = Dim.Auto (DimAutoStyle.Content, maximumContentDim: Dim.Percent(20)),
+            Width = Dim.Auto (DimAutoStyle.Content, maximumContentDim: Dim.Func (() => view.GetContentSize ().Width)),
+            Height = Dim.Auto (DimAutoStyle.Content, maximumContentDim: Dim.Percent (20)),
         };
 
         charMap.Accept += (s, e) =>

+ 2 - 1
UICatalog/Scenarios/Scrolling.cs

@@ -44,10 +44,11 @@ public class Scrolling : Scenario
             ShowVerticalScrollIndicator = true,
             ShowHorizontalScrollIndicator = true
         };
+        // BUGBUG: set_ContentSize is supposed to be `protected`. 
         scrollView.SetContentSize (new (120, 40));
         scrollView.Padding.Thickness = new (1);
 
-        label.Text = $"{scrollView}\nContentSize: {scrollView.ContentSize}\nContentOffset: {scrollView.ContentOffset}";
+        label.Text = $"{scrollView}\nContentSize: {scrollView.GetContentSize ()}\nContentOffset: {scrollView.ContentOffset}";
 
         const string rule = "0123456789";
 

+ 0 - 1
UnitTests/UICatalog/ScenarioTests.cs

@@ -341,7 +341,6 @@ public class ScenarioTests : TestsAllViews
 
             try
             {
-
                 switch (_xRadioGroup.SelectedItem)
                 {
                     case 0:

+ 22 - 6
UnitTests/View/Layout/Dim.AutoTests.cs

@@ -671,7 +671,7 @@ public class DimAutoTests (ITestOutputHelper output)
 
         superView.BeginInit ();
         superView.EndInit ();
-        superView.SetRelativeLayout (superView.ContentSize);
+        superView.SetRelativeLayout (superView.GetContentSize ());
 
         superView.LayoutSubviews ();
         Assert.Equal (expectedSubWidth, subView.Frame.Width);
@@ -720,7 +720,7 @@ public class DimAutoTests (ITestOutputHelper output)
 
         superView.BeginInit ();
         superView.EndInit ();
-        superView.SetRelativeLayout (superView.ContentSize);
+        superView.SetRelativeLayout (superView.GetContentSize ());
 
         superView.LayoutSubviews ();
         Assert.Equal (expectedSubWidth, subView.Frame.Width);
@@ -745,7 +745,7 @@ public class DimAutoTests (ITestOutputHelper output)
         super.Add (view);
 
         Rectangle expectedViewport = new (0, 0, 8, 1);
-        Assert.Equal (expectedViewport.Size, view.ContentSize);
+        Assert.Equal (expectedViewport.Size, view.GetContentSize ());
         Assert.Equal (expectedViewport, view.Frame);
         Assert.Equal (expectedViewport, view.Viewport);
 
@@ -943,19 +943,19 @@ public class DimAutoTests (ITestOutputHelper output)
         };
 
         Assert.Equal (new Rectangle (0, 0, 5, 1), view.Frame);
-        Assert.Equal (new Size (5, 1), view.ContentSize);
+        Assert.Equal (new Size (5, 1), view.GetContentSize ());
 
         // Change text to a longer string
         view.Text = "0123456789";
 
         Assert.Equal (new Rectangle (0, 0, 10, 1), view.Frame);
-        Assert.Equal (new Size (10, 1), view.ContentSize);
+        Assert.Equal (new Size (10, 1), view.GetContentSize ());
 
         // If ContentSize was reset, these should cause it to update
         view.Width = 5;
         view.Height = 1;
 
-        Assert.Equal (new Size (5, 1), view.ContentSize);
+        Assert.Equal (new Size (5, 1), view.GetContentSize ());
     }
 
     // DimAutoStyle.Content tests
@@ -972,6 +972,22 @@ public class DimAutoTests (ITestOutputHelper output)
         Assert.Equal (10, calculatedWidth);
     }
 
+    [Fact]
+    public void DimAutoStyle_Content_IgnoresSubviews_When_ContentSize_Is_Set ()
+    {
+        var view = new View ();
+        var subview = new View () {
+                Frame = new Rectangle (50, 50, 1, 1)
+        };
+        view.SetContentSize (new (10, 5));
+
+        var dim = Dim.Auto (DimAutoStyle.Content);
+
+        int calculatedWidth = dim.Calculate (0, 100, view, Dimension.Width);
+
+        Assert.Equal (10, calculatedWidth);
+    }
+
     [Fact]
     public void DimAutoStyle_Content_IgnoresText_WhenContentSizeNotSet ()
     {

+ 45 - 2
UnitTests/View/Layout/ViewportTests.cs

@@ -338,14 +338,57 @@ public class ViewportTests (ITestOutputHelper output)
     }
 
     [Fact]
-    public void ContentSize_Matches_ViewportSize_If_Not_Set ()
+    public void ContentSize_Tracks_ViewportSize_If_Not_Set ()
     {
         View view = new ()
         {
             Width = 1,
             Height = 1
         };
-        Assert.Equal (view.Viewport.Size, view.ContentSize);
+        Assert.True (view.ContentSizeTracksViewport);
+        Assert.Equal (view.Viewport.Size, view.GetContentSize ());
+    }
+
+    [Fact]
+    public void ContentSize_Ignores_ViewportSize_If_Set ()
+    {
+        View view = new ()
+        {
+            Width = 1,
+            Height = 1,
+        };
+        view.SetContentSize (new Size (5, 5));
+        Assert.False (view.ContentSizeTracksViewport);
+        Assert.NotEqual (view.Viewport.Size, view.GetContentSize ());
+    }
+
+    [Fact]
+    public void ContentSize_Tracks_ViewportSize_If_ContentSizeTracksViewport_Is_True ()
+    {
+        View view = new ()
+        {
+            Width = 1,
+            Height = 1,
+        };
+        view.SetContentSize (new Size (5, 5));
+        view.Viewport = new (0, 0, 10, 10);
+        view.ContentSizeTracksViewport = true;
+        Assert.Equal (view.Viewport.Size, view.GetContentSize ());
+    }
+
+
+    [Fact]
+    public void ContentSize_Ignores_ViewportSize_If_ContentSizeTracksViewport_Is_False ()
+    {
+        View view = new ()
+        {
+            Width = 1,
+            Height = 1,
+        };
+        view.SetContentSize (new Size (5, 5));
+        view.Viewport = new (0, 0, 10, 10);
+        view.ContentSizeTracksViewport = false;
+        Assert.NotEqual (view.Viewport.Size, view.GetContentSize ());
     }
 
     //[Theory]

+ 42 - 1
UnitTests/View/SubviewTests.cs

@@ -75,7 +75,7 @@ public class SubviewTests
         w2.Dispose ();
         top2.Dispose ();
     }
-    
+
     [Fact]
     [TestRespondersDisposed]
     public void Initialized_Event_Comparing_With_Added_Event ()
@@ -332,4 +332,45 @@ public class SubviewTests
         top.Dispose ();
         view.Dispose ();
     }
+
+    // TODO: Consider a feature that will change the ContentSize to fit the subviews.
+    [Fact]
+    public void Add_Does_Not_Impact_ContentSize ()
+    {
+        var view = new View ();
+        view.SetContentSize (new Size (1, 1));
+
+        var subview = new View ()
+        {
+            X = 10,
+            Y = 10
+        };
+
+        Assert.Equal (new Size (1, 1), view.GetContentSize ());
+        view.Add (subview);
+        Assert.Equal (new Size (1, 1), view.GetContentSize ());
+    }
+
+    [Fact]
+    public void Remove_Does_Not_Impact_ContentSize ()
+    {
+        var view = new View ();
+        view.SetContentSize (new Size (1, 1));
+
+        var subview = new View ()
+        {
+            X = 10,
+            Y = 10
+        };
+
+        Assert.Equal (new Size (1, 1), view.GetContentSize ());
+        view.Add (subview);
+        Assert.Equal (new Size (1, 1), view.GetContentSize ());
+
+        view.SetContentSize (new Size (5, 5));
+        Assert.Equal (new Size (5, 5), view.GetContentSize ());
+
+        view.Remove (subview);
+        Assert.Equal (new Size (5, 5), view.GetContentSize ());
+    }
 }

+ 1 - 1
UnitTests/View/TextTests.cs

@@ -32,7 +32,7 @@ public class TextTests (ITestOutputHelper output)
     public void TextFormatter_Size_Tracks_ContentSize (string text, int expectedW, int expectedH)
     {
         var view = new View ();
-        view.SetContentSize(new (1,1));
+        view.SetContentSize (new (1,1));
         view.Text = text;
         Assert.Equal (new (expectedW, expectedH), view.TextFormatter.Size);
     }

+ 1 - 1
UnitTests/View/TitleTests.cs

@@ -102,7 +102,7 @@ public class TitleTests (ITestOutputHelper output)
         Assert.Equal (text, view.Text);
 
         // SetupFakeDriver only create a screen with 25 cols and 25 rows
-        Assert.Equal (new (text.Length, 1), view.ContentSize);
+        Assert.Equal (new (text.Length, 1), view.GetContentSize ());
 
         top.Dispose ();
     }

+ 2 - 2
UnitTests/Views/ButtonTests.cs

@@ -62,7 +62,7 @@ public class ButtonTests (ITestOutputHelper output)
 
         Assert.Equal (new Size (expectedWidth, expectedHeight), btn1.Frame.Size);
         Assert.Equal (new Size (expectedWidth, expectedHeight), btn1.Viewport.Size);
-        Assert.Equal (new Size (expectedWidth, expectedHeight), btn1.ContentSize);
+        Assert.Equal (new Size (expectedWidth, expectedHeight), btn1.GetContentSize ());
         Assert.Equal (new Size (expectedWidth, expectedHeight), btn1.TextFormatter.Size);
 
         btn1.Dispose ();
@@ -204,7 +204,7 @@ public class ButtonTests (ITestOutputHelper output)
         Assert.Equal ('_', btn.HotKeySpecifier.Value);
         Assert.Equal (10, btn.TextFormatter.Format ().Length);
         Assert.Equal (new (10, 1), btn.TextFormatter.Size);
-        Assert.Equal (new (10, 1), btn.ContentSize);
+        Assert.Equal (new (10, 1), btn.GetContentSize ());
         Assert.Equal (new (0, 0, 10, 1), btn.Viewport);
         Assert.Equal (new (0, 0, 10, 1), btn.Frame);
         Assert.Equal (KeyCode.T, btn.HotKey);

+ 6 - 6
UnitTests/Views/ScrollViewTests.cs

@@ -19,7 +19,7 @@ public class ScrollViewTests
                 new View { X = 12, Y = 7, Width = 10, Height = 5 }
                );
 
-        Assert.Equal (new (30, 20), sv.ContentSize);
+        Assert.Equal (new (30, 20), sv.GetContentSize ());
         Assert.Equal (2, sv.Subviews [0].Subviews.Count);
     }
 
@@ -345,7 +345,7 @@ public class ScrollViewTests
         Assert.Equal (new Rectangle (0, 0, 0, 0), sv.Frame);
         Assert.Equal (Rectangle.Empty, sv.Frame);
         Assert.Equal (Point.Empty, sv.ContentOffset);
-        Assert.Equal (Size.Empty, sv.ContentSize);
+        Assert.Equal (Size.Empty, sv.GetContentSize ());
         Assert.True (sv.AutoHideScrollBars);
         Assert.True (sv.KeepContentAlwaysInViewport);
 
@@ -353,7 +353,7 @@ public class ScrollViewTests
         Assert.True (sv.CanFocus);
         Assert.Equal (new Rectangle (1, 2, 20, 10), sv.Frame);
         Assert.Equal (Point.Empty, sv.ContentOffset);
-        Assert.Equal (sv.Viewport.Size, sv.ContentSize);
+        Assert.Equal (sv.Viewport.Size, sv.GetContentSize ());
         Assert.True (sv.AutoHideScrollBars);
         Assert.True (sv.KeepContentAlwaysInViewport);
     }
@@ -453,7 +453,7 @@ public class ScrollViewTests
         Application.Begin (top);
 
         Assert.Equal (new (-25, -25), sv.ContentOffset);
-        Assert.Equal (new (50, 50), sv.ContentSize);
+        Assert.Equal (new (50, 50), sv.GetContentSize ());
         Assert.True (sv.AutoHideScrollBars);
         Assert.True (sv.ShowHorizontalScrollIndicator);
         Assert.True (sv.ShowVerticalScrollIndicator);
@@ -486,8 +486,8 @@ public class ScrollViewTests
         top.Add (sv);
         Application.Begin (top);
 
-        Assert.Equal (50, sv.ContentSize.Width);
-        Assert.Equal (50, sv.ContentSize.Height);
+        Assert.Equal (50, sv.GetContentSize ().Width);
+        Assert.Equal (50, sv.GetContentSize ().Height);
         Assert.True (sv.AutoHideScrollBars);
         Assert.True (sv.ShowHorizontalScrollIndicator);
         Assert.True (sv.ShowVerticalScrollIndicator);

+ 1 - 1
UnitTests/Views/SliderTests.cs

@@ -175,7 +175,7 @@ public class SliderTests
         // 0123456789
         // 1 2 3
         Assert.Equal (1, slider.MinimumInnerSpacing);
-        Assert.Equal (new Size (5, 2), slider.ContentSize);
+        Assert.Equal (new Size (5, 2), slider.GetContentSize ());
         Assert.Equal (new Size (5, 2), slider.Frame.Size);
         Assert.NotNull (slider);
         Assert.NotNull (slider.Options);

+ 2 - 2
docfx/docs/dimauto.md

@@ -7,7 +7,7 @@ Like all `Dim` types, `Dim.Auto` is used to set the `Width` or `Height` of a vie
 The `DimAutoStyle` enum defines the different ways that `Dim.Auto` can be used to size a view. The `DimAutoStyle` enum has the following values:
 
 * `Text` - The view is sized based on the `Text` property and `TextFormatter` settings.
-* `Content` - The view is sized based on either the `ContentSize` or the `Subviews` property. If `ContentSize` is not explicitly set (via `View.SetContentSize()`), the view is sized based on the Subview with the largest relvant dimension plus location. If `ContentSize` is explicitly set, the view is sized based on the `ContentSize`.
+* `Content` - The view is sized based on either the value returned by `View.SetContentSize()` or the `Subviews` property. If the content size is not explicitly set (via `View.SetContentSize()`), the view is sized based on the Subview with the largest relvant dimension plus location. If the content size is explicitly set, the view is sized based on the value returned by `View.SetContentSize()`.
 * `Auto` -  The view is sized based on both the text and content, whichever is larger.
 
 ## Using Dim.Auto
@@ -113,6 +113,6 @@ view.Add (slider);
 
 Note the developer does not need to specify the size of the `Slider`, it will size itself based on the number of options and the orientation. 
 
-Views like `Slider` do this by setting `Width` and `Height` to `Dim.Auto (DimAutoStyle.Content)` in the constructor and calling `SetContentSize ()` whenever the desired content size changes. The View will then be sized to be big enough to fit the content.
+Views like `Slider` do this by setting `Width` and `Height` to `Dim.Auto (DimAutoStyle.Content)` in the constructor and calling `SetContentSize()` whenever the desired content size changes. The View will then be sized to be big enough to fit the content.
 
 Views that use `Text` for their content can just set `Width` and `Height` to `Dim.Auto (DimAutoStyle.Text)`. It is recommended to use `Height = Dim.Auto (DimAutoStyle.Text, minimumContentDim: 1)` to ensure the View can show at least one line of text.

+ 7 - 13
docfx/docs/layout.md

@@ -7,22 +7,22 @@ Terminal.Gui provides a rich system for how `View` objects are laid out relative
 * **Screen-Relative** - Describes the dimensions and characteristics of the underlying terminal. Currently Terminal.Gui only supports applications that run "full-screen", meaning they fill the entire terminal when running. As the user resizes their terminal, the `Screen` changes size and the applicaiton will be resized to fit. *Screen-Relative* means an origin (`0, 0`) at the top-left corner of the terminal. `ConsoleDriver`s operate exclusively on *Screen-Relative* coordinates.
 * **Application.Relative** - The dimensions and characteristics of the application. Because only full-screen apps are currently supported, `Application` is effectively the same as `Screen` from a layout perspective. *Application-Relative* currently means an origin (`0, 0`) at the top-left corner of the terminal. `Applicaiton.Top` is a `View` with a top-left corner fixed at the *Application.Relative* coordinate of (`0, 0`) and is the size of `Screen`.
 * **Frame-Relative**  - The `Frame` property of a `View` is a rectangle that describes the current location and size of the view relative to the `Superview`'s content area. *Frame-Relative* means a coordinate is relative to the top-left corner of the View in question. `View.FrameToScreen ()` and `View.ScreenToFrame ()` are helper methods for translating a *Frame-Relative* coordinate to a *Screen-Relative* coordinate and vice-versa.
-* **Content-Relative** - A rectangle, with an origin of (`0, 0`) and size (defined by `View.ContentSize`) where the View's content exists. *Content-Relative* means a coordinate is relative to the top-left corner of the content, which is always (`0,0`). `View.ContentToScreen ()` and `View.ScreenToContent ()` are helper methods for translating a *Content-Relative* coordinate to a *Screen-Relative* coordinate and vice-versa.
-* **Viewport-Relative** - A *Content-Relative* rectangle representing the subset of the View's content that is visible to the user. If `View.ContentSize` is larger than the Viewport, scrolling is enabled. *Viewport-Relative* means a coordinate that is bound by (`0,0`) and the size of the inner-rectangle of the View's `Padding`. The View drawing primitives (e.g. `View.Move`) take *Viewport-Relative* coordinates; `Move (0, 0)` means the `Cell` in the top-left corner of the inner rectangle of `Padding`. `View.ViewportToScreen ()` and `View.ScreenToViewport ()` are helper methods for translating a *Viewport-Relative* coordinate to a *Screen-Relative* coordinate and vice-versa. To convert a *Viewport-Relative* coordinate to a *Content-Relative* coordinate, simply subtract `Viewport.X` and/or `Viewport.Y` from the *Content-Relative* coordinate. To convert a *Viewport-Relative* coordinate to a *Frame-Relative* coordinate, subtract the point returned by `View.GetViewportOffsetFromFrame`.
+* **Content-Relative** - A rectangle, with an origin of (`0, 0`) and size (defined by `View.GetContentSize()`) where the View's content exists. *Content-Relative* means a coordinate is relative to the top-left corner of the content, which is always (`0,0`). `View.ContentToScreen ()` and `View.ScreenToContent ()` are helper methods for translating a *Content-Relative* coordinate to a *Screen-Relative* coordinate and vice-versa.
+* **Viewport-Relative** - A *Content-Relative* rectangle representing the subset of the View's content that is visible to the user. If `View.GetContentSize()` is larger than the Viewport, scrolling is enabled. *Viewport-Relative* means a coordinate that is bound by (`0,0`) and the size of the inner-rectangle of the View's `Padding`. The View drawing primitives (e.g. `View.Move`) take *Viewport-Relative* coordinates; `Move (0, 0)` means the `Cell` in the top-left corner of the inner rectangle of `Padding`. `View.ViewportToScreen ()` and `View.ScreenToViewport ()` are helper methods for translating a *Viewport-Relative* coordinate to a *Screen-Relative* coordinate and vice-versa. To convert a *Viewport-Relative* coordinate to a *Content-Relative* coordinate, simply subtract `Viewport.X` and/or `Viewport.Y` from the *Content-Relative* coordinate. To convert a *Viewport-Relative* coordinate to a *Frame-Relative* coordinate, subtract the point returned by `View.GetViewportOffsetFromFrame`.
 
 ## The Frame
 
-The `Frame` property of a `View` is a rectangle that describes the current location and size of the view relative to the `Superview`'s content area. The `Frame`  has a `Location` and `Size`. The `Location` describes the top-left corner of the view relative to the `Superview`'s content area. The `Size` describes the width and height of the view. The `Frame` is used to determine where the view is drawn on the screen and is used to calculate the `Viewport` and `ContentSize`.
+The `Frame` property of a `View` is a rectangle that describes the current location and size of the view relative to the `Superview`'s content area. The `Frame`  has a `Location` and `Size`. The `Location` describes the top-left corner of the view relative to the `Superview`'s content area. The `Size` describes the width and height of the view. The `Frame` is used to determine where the view is drawn on the screen and is used to calculate the Viewport and content size.
 
 ## The Content Area
 
- The content area is the area where the view's content is drawn. Content can be any combination of the `View.Text` property, `Subviews`, and other content drawn by the View. The `View.ContentSize` property gets the size of the content area of the view. *Content Area* refers to the rectangle with a location of `0,0` with a size of `ContentSize`.
+ The content area is the area where the view's content is drawn. Content can be any combination of the `View.Text` property, `Subviews`, and other content drawn by the View. The `View.GetContentSize()` property gets the size of the content area of the view. *Content Area* refers to the rectangle with a location of `0,0` with a size of `ContentSize`.
 
- `ContentSize` tracks the size of the `Viewport` by default. If `ContentSize` is set via `SetContentSize()`, the content area is the provided size. If `ContentSize` is larger than the `Viewport`, scrolling is enabled. 
+ The Content size tracks the size of the `Viewport` by default. If the content size is set via `SetContentSize()`, the content area is the provided size. If the content size is larger than the `Viewport`, scrolling is enabled. 
 
 ## The Viewport
 
-The Viewport (`View.Viewport`) is a rectangle describing the portion of the *Content Area* that is currently visible to the user. It is a "portal" into the content. The `Viewport.Location` is relative to the top-left corner of the inner rectangle of `View.Padding`. If `Viewport.Size` is the same as `View.ContentSize`, `Viewport.Location` will be `0,0`. 
+The Viewport (`View.Viewport`) is a rectangle describing the portion of the *Content Area* that is currently visible to the user. It is a "portal" into the content. The `Viewport.Location` is relative to the top-left corner of the inner rectangle of `View.Padding`. If `Viewport.Size` is the same as `View.GetContentSize()`, `Viewport.Location` will be `0,0`. 
 
 To enable scrolling call `View.SetContentSize()` and then set `Viewport.Location` to positive values. Making `Viewport.Location` positive moves the Viewport down and to the right in the content. 
 
@@ -32,17 +32,11 @@ The default `ViewportSettings` also constrains the Viewport to the size of the c
 
 ## Layout
 
-Terminal.Gui provides a rich system for how views are laid out relative to each other. **Computed Layout** means the position and size of a View is being computed by the layout engine. **Absolute Layout** means the position and size of a View has been declared to be an absolute values. The position of a view is set by setting the `X` and `Y` properties, which are of time [Pos](~/api/Terminal.Gui.Pos.yml). The size is set via `Width` and `Height`, which are of type [Dim](~/api/Terminal.Gui.Dim.yml).
-
-* **Computed Layout** supports dynamic console apps where UI elements (Views) automatically adjust as the terminal resizes or other Views change size or position. The X, Y, Width, and Height properties are Dim and Pos objects that dynamically update the position of a view.
-
-* **Absolute Layout** requires specifying coordinates and sizes of Views explicitly, and the View will typically stay in a fixed position and size.
+Terminal.Gui provides a rich system for how views are laid out relative to each other. The position of a view is set by setting the `X` and `Y` properties, which are of time [Pos](~/api/Terminal.Gui.Pos.yml). The size is set via `Width` and `Height`, which are of type [Dim](~/api/Terminal.Gui.Dim.yml).
 
 ```cs
-// Absolute layout using a absoulte values for X, Y, Width, and Height
 var label1 = new Label () { X = 1, Y = 2, Width = 3, Height = 4, Title = "Absolute")
 
-// Computed Layout using Pos and Dim objects for X, Y, Width, and Height
 var label2 = new Label () {
     Title = "Computed",
     X = Pos.Right (otherView),

+ 5 - 5
docfx/docs/migratingfromv1.md

@@ -117,7 +117,7 @@ In v2, the layout system has been improved to make it easier to create complex u
 * The distinction between `Absoulte Layout` and `Computed Layout` has been removed, as has the `LayoutStyle` enum. v1 drew a false distinction between these styles. 
 * [View.Frame](~/api/Terminal.Gui.View.Frame.yml) now represents the position and size of the view in the superview's coordinate system. The `Frame` property is of type `Rectangle`.
 * [View.Bounds](~/api/Terminal.Gui.View.Bounds.yml) has been replaced by [View.Viewport](~/api/Terminal.Gui.View.Viewport.yml). The `Viewport` property represents the visible area of the view in its own coordinate system. The `Viewport` property is of type `Rectangle`.
-* [View.ContentSize](~/api/Terminal.Gui.View.ContentSize.yml) represents the size of the view's content. The `ContentSize` property is of type `Size`. This replaces `ScrollView` and `ScrollBarView` in v1. See more below.
+* [View.GetContentSize()](~/api/Terminal.Gui.View.GetContentSize.yml) represents the size of the view's content. This replaces `ScrollView` and `ScrollBarView` in v1. See more below.
 
 ### How to Fix
 
@@ -126,7 +126,7 @@ In v2, the layout system has been improved to make it easier to create complex u
 * Remove all references ot `LayoutStyle`.
 * Rename `Bounds` to `Viewport`. The `Location` property of `Bounds` can now have non-zero values.
 * Update any code that assumed `Bounds.Location` was always `Point.Empty`.
-* Update any code that used `Bounds` to refer to the size of the view's content. Use `ContentSize` instead.
+* Update any code that used `Bounds` to refer to the size of the view's content. Use `GetContentSize()` instead.
 * Update any code that assumed `Bounds.Size` was the same as `Frame.Size`. `Frame.Size` defines the size of the view in the superview's coordinate system, while `Viewport.Size` defines the visible area of the view in its own coordinate system.
 * Use [View.GetAdornmentsThickness](~/api/Terminal.Gui.View.GetAdornmentsThickness.yml) to get the total thickness of the view's border, margin, and padding.
 * Not assume a View can draw outside of 'Viewport'. Use the 'Margin', 'Border', and 'Padding' Adornments to do things outside of `Viewport`. View subclasses should not implement their own concept of padding or margins but leverage these `Adornments` instead. 
@@ -150,13 +150,13 @@ In v2, the `Border`, `Margin`, and `Padding` properties have been added to all v
 
 ## Built-in Scrolling
 
-In v1, scrolling was enabled by using `ScrollView` or `ScrollBarView`. In v2, the base [View](~/api/Terminal.Gui.View.yml) class supports scrolling inherently. The area of a view visible to the user at a given moment was previously a rectangle called `Bounds`. `Bounds.Location` was always `Point.Empty`. In v2 the visible area is a rectangle called `Viewport` which is a protal into the Views content, which can be bigger (or smaller) than the area visible to the user. Causing a view to scroll is as simple as changing `View.Viewport.Location`. The View's content described by [View.ContentSize](~/api/Terminal.Gui.View.ContentSize.yml). See [Layout](layout.md) for details.
+In v1, scrolling was enabled by using `ScrollView` or `ScrollBarView`. In v2, the base [View](~/api/Terminal.Gui.View.yml) class supports scrolling inherently. The area of a view visible to the user at a given moment was previously a rectangle called `Bounds`. `Bounds.Location` was always `Point.Empty`. In v2 the visible area is a rectangle called `Viewport` which is a protal into the Views content, which can be bigger (or smaller) than the area visible to the user. Causing a view to scroll is as simple as changing `View.Viewport.Location`. The View's content described by [View.GetContentSize()](~/api/Terminal.Gui.View.GetContentSize.yml). See [Layout](layout.md) for details.
 
 ### How to Fix
 
-* Replace `ScrollView` with [View](~/api/Terminal.Gui.View.yml) and use the `Viewport` and `ContentSize` properties to control scrolling.
+* Replace `ScrollView` with [View](~/api/Terminal.Gui.View.yml) and use `Viewport` and [View.GetContentSize()](~/api/Terminal.Gui.View.GetContentSize.yml) to control scrolling.
 * Update any code that assumed `Bounds.Location` was always `Point.Empty`.
-* Update any code that used `Bounds` to refer to the size of the view's content. Use `ContentSize` instead.
+* Update any code that used `Bounds` to refer to the size of the view's content. Use [View.GetContentSize()](~/api/Terminal.Gui.View.GetContentSize.yml) instead.
 * Update any code that assumed `Bounds.Size` was the same as `Frame.Size`. `Frame.Size` defines the size of the view in the superview's coordinate system, while `Viewport.Size` defines the visible area of the view in its own coordinate system.
 
 ## Updated Keyboard API

+ 1 - 1
docfx/docs/newinv2.md

@@ -24,7 +24,7 @@ The entire library has been reviewed and simplified. As a result, the API is mor
   * In v1, `View` was derived from `Responder` which supported `IDisposable`. In v2, `Responder` has been removed and `View` is the base-class supporting `IDisposable`. 
   * `Application.Init` no longer automatically creates a toplevel or sets `Applicaton.Top`; app developers must explicitly create the toplevel view and pass it to `Appliation.Run` (or use `Application.Run<myTopLevel>`). Developers are responsible for calling `Dispose` on any toplevel they create before exiting. 
 * New! *Adornments* -  Adornments are a special form of View that appear outside the `Viewport`: `Margin`, `Border`, and `Padding`.
-* New! *Built-in Scrolling/Virtual Content Area* - In v1, to have a view a user could scroll required either a bespoke scrolling implementation, inheriting from `ScrollView`, or managing the complexity of `ScrollBarView` directly. In v2, the base-View class supports scrolling inherently. The area of a view visible to the user at a given moment was previously a rectangle called `Bounds`. `Bounds.Location` was always `Point.Empty`. In v2 the visible area is a rectangle called `Viewport` which is a protal into the Views content, which can be bigger (or smaller) than the area visible to the user. Causing a view to scroll is as simple as changing `View.Viewport.Location`. The View's content described by `View.ContentSize`. See [Layout](layout.md) for details.
+* New! *Built-in Scrolling/Virtual Content Area* - In v1, to have a view a user could scroll required either a bespoke scrolling implementation, inheriting from `ScrollView`, or managing the complexity of `ScrollBarView` directly. In v2, the base-View class supports scrolling inherently. The area of a view visible to the user at a given moment was previously a rectangle called `Bounds`. `Bounds.Location` was always `Point.Empty`. In v2 the visible area is a rectangle called `Viewport` which is a protal into the Views content, which can be bigger (or smaller) than the area visible to the user. Causing a view to scroll is as simple as changing `View.Viewport.Location`. The View's content described by `View.GetContentSize()`. See [Layout](layout.md) for details.
 * New! *`Dim.Auto`* - Automatically sizes the view to fitthe view's Text, SubViews, or ContentArea.
 * Improved! *`Pos.AnchorEnd ()`* - New to v2 is `Pos.AnchorEnd ()` (with no parameters) which allows a view to be anchored to the right or bottom of the Superview. 
 * New! *`Pos.Align ()`* - Aligns a set of views horizontally or vertically (left, rigth, center, etc...).