Table of Contents

Method Auto

Namespace
Terminal.Gui
Assembly
Terminal.Gui.dll

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

style DimAutoStyle

Specifies how Auto(DimAutoStyle, Dim?, Dim?) will compute the dimension. The default is Auto.

minimumContentDim Dim

The minimum dimension the View's ContentSize will be constrained to.

maximumContentDim Dim

The maximum dimension the View's ContentSize will be fit to.

Returns

Dim

The Dim object.

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