Xamarin.Forms Guides | Samples

Xamarin.Forms.ContentView Class

An element that contains a single child element.

See Also: ContentView


public class ContentView : TemplatedView


XAML for Xamarin.Forms supports the following property for the ContentView class:


The View object that represents the visual content of the ContentView.

The following example shows how to construct a new ContentView with a Label inside.

C# Example

MainPage = new ContentPage () {
    // Accomodate iPhone status bar.
    Padding = new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 5),
        Content = new ContentView {
            Content = new Label { Text = "I'm Content!" },


Namespace: Xamarin.Forms
Assembly: Xamarin.Forms.Core (in Xamarin.Forms.Core.dll)
Assembly Versions:,,,,,,

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

See Also: TemplatedView

Public Constructors

Initializes a new instance fo the ContentView class.

Public Fields

static readonly
ContentPropertyBindableProperty. Backing store for the ContentView.Content property..

Public Properties

ContentView. Gets or sets the content of the ContentView.

Protected Methods

LayoutChildren(Double, Double, Double, Double)
Positions and sizes the content of a ContentView.
Method that is called when the binding context changes.
OnSizeRequest(Double, Double) : SizeRequest
This method is called during the measure pass of a layout cycle to get the desired size of the ContentView.