See Also: ContentPage Members
This is a Page displaying a single View, often a container like a Xamarin.Forms.StackLayout or Xamarin.Forms.ScrollView.
The example below is taken from he App.cs file that is contained in the default "Hello, Forms!" app. It uses a Xamarin.Forms.ContenPage to display a label, which is a typical, though basic, use of the Xamarin.Forms.ContenPage class.
C# Example
using System;
using Xamarin.Forms;
namespace ContentPageExample
{
public class App
{
public static Page GetMainPage ()
{
return new ContentPage {
Content = new Label {
Text = "Hello, Forms!",
VerticalOptions = LayoutOptions.CenterAndExpand,
HorizontalOptions = LayoutOptions.CenterAndExpand,
},
};
}
}
}
The FormsGallery sample, which can be found on the Sample Applications page, has a ContentPageDemoPage.cs file. This file contains a longer and more complicated example.
The Xamarin.Forms.ContentPage class has the following XAML property:
| Property | Value |
|---|---|
| Content | A list of Xamarin.Forms.View objects that represent the visual content of the Xamarin.Forms.ContentPage. This tag can be omitted, and the contents listed directly. |