ContentPropertyAttribute ContentPropertyAttribute Class

Definition

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

[System.AttributeUsage(System.AttributeTargets.Class)]
public sealed class ContentPropertyAttribute : Attribute
type ContentPropertyAttribute = class
    inherit Attribute
Inheritance
ContentPropertyAttributeContentPropertyAttribute
Attributes

Remarks

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:


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

This is equivalent to the following, more explicit XAML


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

Constructors

ContentPropertyAttribute(String) ContentPropertyAttribute(String)

Initializes a new instance of the ContentPropertyAttribute class.

Properties

Name Name

Gets the name of the content property

Applies to