Sdílet prostřednictvím


ContentPropertyAttribute Třída

Definice

Označuje vlastnost použitou jako vlastnost obsahu v 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
Dědičnost
ContentPropertyAttribute
Atributy

Poznámky

Procesor XAML používá k určení vlastnosti obsahu.

Dekódování typů pomocí ContentPropertyAttribute umožňuje kratší syntaxi XAML. As

ContentView má použitý atribut ContentProperty, tento XAML je platný:
<ContentView>
<Label Text="Hello, Forms"/>
</ContentView>

To odpovídá následujícímu, explicitnějšímu xamlu.

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

Konstruktory

Name Description
ContentPropertyAttribute(String)

Vytvoří novou ContentPropertyAttribute se zadaným názvem vlastnosti.

Vlastnosti

Name Description
Name

Získá název vlastnosti obsahu.

Platí pro