Method Auto
Auto(DimAutoStyle, Dim?, Dim?)
Creates a Dim object that automatically sizes the view to fit all the view's Content, SubViews, and/or Text.
public static Dim Auto(DimAutoStyle style = DimAutoStyle.Auto, Dim? minimumContentDim = null, Dim? maximumContentDim = null)
Parameters
styleDimAutoStyleSpecifies how Auto(DimAutoStyle, Dim?, Dim?) will compute the dimension. The default is Auto.
minimumContentDimDimThe minimum dimension the View's ContentSize will be constrained to.
maximumContentDimDimThe maximum dimension the View's ContentSize will be fit to.
Returns
Examples
This initializes a View with two SubViews. The view will be automatically sized to fit the two SubViews.
var button = new Button () { Text = "Click Me!", X = 1, Y = 1, Width = 10, Height = 1 };
var textField = new TextField { Text = "Type here", X = 1, Y = 2, Width = 20, Height = 1 };
var view = new Window () { Title = "MyWindow", X = 0, Y = 0, Width = Dim.Auto (), Height = Dim.Auto () };
view.Add (button, textField);
Remarks
See DimAutoStyle.
See the Dim.Auto Deep Dive for comprehensive documentation including non-trivial usage patterns.
SubViews that use Fill() do not contribute to the auto-sizing calculation unless
MinimumContentDim is specified. Without it, a DimFill SubView will
receive a size of 0. Use Fill(Dim, Dim?) with a minimumContentDim to ensure
the SubView contributes a minimum size.