Partilhar via


ContentPropertyAttribute Classe

Definição

Indica a propriedade usada como propriedade de conteúdo em XAML.

public ref class ContentPropertyAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=false, Inherited=true)]
public sealed class ContentPropertyAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=false, Inherited=true)>]
type ContentPropertyAttribute = class
    inherit Attribute
Public NotInheritable Class ContentPropertyAttribute
Inherits Attribute
Herança
ContentPropertyAttribute
Atributos

Observações

O processador XAML é usado para determinar a propriedade de conteúdo.

Decorar tipos com ContentPropertyAttribute permite uma sintaxe XAML mais curta. As

ContentView tem um atributo ContentProperty aplicado, este XAML é válido:
<ContentView>
<Label Text="Hello, Forms"/>
</ContentView>

Isto é equivalente ao seguinte, mais explícito, XAML

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

Construtores

Nome Descrição
ContentPropertyAttribute(String)

Cria um novo ContentPropertyAttribute com o nome de propriedade especificado.

Propriedades

Nome Descrição
Name

Obtém o nome da propriedade de conteúdo.

Aplica-se a