Bagikan melalui


ContentPropertyAttribute Kelas

Definisi

Menunjukkan properti jenis yang merupakan properti konten (default).

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
Warisan
ContentPropertyAttribute
Atribut

Keterangan

Prosesor XAML menggunakan untuk menentukan properti konten.

Menghias jenis dengan ContentPropertyAttribute memungkinkan sintaks XAML yang lebih pendek. Sebagai

ContentView memiliki atribut ContentProperty yang diterapkan, XAML ini valid:
<ContentView>
<Label Text="Hello, Forms"/>
</ContentView>

Ini setara dengan XAML yang lebih eksplisit dan lebih eksplisit

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

Konstruktor

ContentPropertyAttribute(String)

Menginisialisasi instans baru kelas ContentPropertyAttribute.

Properti

Name

Mendapatkan nama properti konten

Berlaku untuk