Xamarin.Forms.ContentPropertyAttribute Class
Indicates the property of the type that is the (default) content property.

See Also: ContentPropertyAttribute Members

Syntax

[System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=false, Inherited=true)]
public sealed class ContentPropertyAttribute : Attribute

Remarks

XAML processor uses to determine the content property.

Decorating types with ContentPropertyAttribute allows shorter XAML syntax. As

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

C# Example

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

C# Example

<ContentView>
  <ContentView.Content>
    <Label Text="Hello, Forms"\>
  </ContentView.Content>
</ContentView>
  

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