共用方式為


Layout<T>.Children Property

Definition

Gets an IList<View> of child element of the Layout.

public System.Collections.Generic.IList<T> Children { get; }
member this.Children : System.Collections.Generic.IList<'T (requires 'T :> Xamarin.Forms.View)>

Property Value

System.Collections.Generic.IList<T>

A IList<View>. The default is an empty list.

Implements

Remarks

The Children collection of a Layout contains all the children added throught the public add/remove interface. Internal children will not be exposed through this collection.

The following shows the creation of a layout, setting a property, and adding the children in the object initializer.

var stack = new StackLayout {
  Spacing = 20,
  Children = {
    new Label {Text = "Hello World!"},
    new Button {Text = "Click Me!"}
  }
};

Applies to