Xamarin.Forms.Layout<T> Class
A base implementation of a layout with undefined behavior and multiple children.

See Also: Layout<T> Members

Syntax

[Xamarin.Forms.ContentProperty("Children")]
public abstract class Layout<T> : Layout, IViewContainer<T>
where T : Xamarin.Forms.View

Type Parameters

T
The subclass of Xamarin.Forms.View the layout contains.

Remarks

Xamarin.Forms.Layout`1s contain Layout`1.Children that are of the type T with which the Xamarin.Forms.Layout`1 was specified. This T must be of type Xamarin.Forms.View. Since Xamarin.Forms.Layouts are subclasses of Xamarin.Forms.View, this means that layouts may be nested, contain scrolling regions, etc.

The following image shows the relationship between Xamarin.Forms.View, Xamarin.Forms.Layout, Xamarin.Forms.Layout`1, and important subtypes.

The following example shows adding and removing elements from a layout.

C# Example

  void UpdateItems (Layout<View> layout, IEnumerable newItems)
  {
    layout.Children.Clear ();
    foreach (var item in newItems) {
      layout.Children.Add (item);
    }
  }
          

Requirements

Namespace: Xamarin.Forms
Assembly: Xamarin.Forms.Core (in Xamarin.Forms.Core.dll)
Assembly Versions: 1.0.0.0, 1.1.0.0, 1.2.0.0, 1.3.0.0