ContentPropertyAttribute 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
指示用作 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
- 继承
-
ContentPropertyAttribute
- 属性
注解
XAML 处理器用于确定内容属性。
使用 ContentPropertyAttribute 修饰类型可以缩短 XAML 语法。 As
ContentView 应用了 ContentProperty 属性,此 XAML 有效:
<ContentView>
<Label Text="Hello, Forms"/>
</ContentView>
这等效于以下更明确的 XAML
<ContentView>
<ContentView.Content>
<Label Text="Hello, Forms"/>
</ContentView.Content>
</ContentView>
构造函数
| 名称 | 说明 |
|---|---|
| ContentPropertyAttribute(String) |
使用指定的属性名称创建一个新 ContentPropertyAttribute 项。 |
属性
| 名称 | 说明 |
|---|---|
| Name |
获取内容属性的名称。 |