From beec30a1350e82e42b5db4b81adf5956fc5e9826 Mon Sep 17 00:00:00 2001 From: Tig Date: Tue, 30 Apr 2024 15:59:39 -0600 Subject: [PATCH] - Edited dimauto.md --- docfx/docs/dimauto.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/docfx/docs/dimauto.md b/docfx/docs/dimauto.md index e83dbfd57..4c1d9714f 100644 --- a/docfx/docs/dimauto.md +++ b/docfx/docs/dimauto.md @@ -12,8 +12,15 @@ The `DimAutoStyle` enum defines the different ways that `Dim.Auto` can be used t ## Using Dim.Auto +`Dim.Auto` is defined as: + +```cs +public static Dim Auto (DimAutoStyle style = DimAutoStyle.Auto, Dim min = null, Dim max = null) +``` + To use `Dim.Auto`, set the `Width` or `Height` property of a view to `Dim.Auto (DimAutoStyle.Text)` or `Dim.Auto (DimAutoStyle.Content)`. + For example, to create a `View` that is sized based on the `Text` property, you can do this: ```cs @@ -40,6 +47,23 @@ view.Add (new Label () { Text = "Hello, World!" }); In this example, the `View` will be sized based on the size of the `Label` that is added to it. +### Specifying a miniumum size + +You can specify a minimum size by passing a `Dim` object to the `min` parameter. For example, to create a `View` that is sized based on the `Text` property, but has a minimum width of 10 columns, you can do this: + +```cs +View view = new () +{ + Text = "Hello, World!", + Width = Dim.Auto (DimAutoStyle.Text, min: Dim.Absolute (10)), + Height = Dim.Auto (DimAutoStyle.Text), +}; +``` + +### Specifying a maximum size + +> NOT YET IMPLEMENTED + ## Limitations `Dim.Auto` is not always the best choice for sizing a view. For example, if you want a view to fill the entire width of the Superview, you should use `Dim.Fill ()` instead of `Dim.Auto (DimAutoStyle.Content)`.