Xamarin.Forms Guides | Samples

Xamarin.Forms.ContentPropertyAttribute Class

Indicates the property of the type that is the (default) content property.

See Also: ContentPropertyAttribute


public sealed class ContentPropertyAttribute : Attribute


XAML processor uses to determine the content property.

Decorating types with ContentPropertyAttribute allows shorter XAML syntax. As

ContentView has a ContentProperty attribute applied, this XAML is valid:

C# Example

  <Label Text="Hello, Forms"\>
This is equivalent to the following, more explicit XAML

C# Example

    <Label Text="Hello, Forms"\>


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

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

See Also: Attribute

Public Constructors

Initializes a new instance of the ContentPropertyAttribute class.

Public Properties

NameString. Gets the name of the content property