Xamarin.Forms Guides | Samples

Xamarin.Forms.View Class

A visual element that is used to place layouts and controls on the screen.

See Also: View

Syntax

public class View : VisualElement, IViewController

Remarks

The View class is a base class for the Layout class, and most of the controls that application developers will use. Nearly all UI elements that an application developer will use are derived from View class. Because the View class ultimately inherits from BindableObject class, application developers can use the Model-View-ViewModel architecture, as well as XAML, to develop portable user interfaces. The remarks in the BindableObject topic provide a discussion of MVVM and bound properties.

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, 1.4.0.0, 1.5.0.0, 2.0.0.0

The members of Xamarin.Forms.View are listed below.

See Also: VisualElement

Protected Constructors

Initializes a new instance of the View class.

Public Fields

static readonly
HorizontalOptionsPropertyBindableProperty. Identifies the HorizontalOptions bindable property.
static readonly
MarginPropertyBindableProperty. Backing store for the View.Margin property.
static readonly
VerticalOptionsPropertyBindableProperty. Identifies the VerticalOptions bindable property.

Public Properties

[read-only]
GestureRecognizersIList<IGestureRecognizer>. The collection of gesture recognizers associated with this view.
HorizontalOptionsLayoutOptions. Gets or sets the LayoutOptions that define how the element gets laid in a layout cycle. This is a bindable property.
MarginThickness. Gets or sets the margin for the view.
VerticalOptionsLayoutOptions. Gets or sets the LayoutOptions that define how the element gets laid in a layout cycle. This is a bindable property.

Protected Methods

override
OnBindingContextChanged()
Invoked whenever the binding context of the View changes. Override this method to add class handling for this event.