Xamarin.Forms ContentView


Example

An element with a single content. ContentView has very little use of its own. Its purpose is to serve as a base class for user-defined compound views.

ContentView Layout (image by Xamarin)

XAML

<ContentView>
<Label Text="Hi, I'm a simple Label inside of a simple ContentView"
HorizontalOptions="Center"
VerticalOptions="Center"/>
</ContentView>

Code

var contentView = new ContentView {
Content = new Label {
 Text = "Hi, I'm a simple Label inside of a simple ContentView",
 HorizontalOptions = LayoutOptions.Center,
 VerticalOptions = LayoutOptions.Center
}
};