浏览代码

- Edited dimauto.md

Tig 1 年之前
父节点
当前提交
beec30a135
共有 1 个文件被更改,包括 24 次插入0 次删除
  1. 24 0
      docfx/docs/dimauto.md

+ 24 - 0
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)`.