ContentPropertyAttribute Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Indicates the property of the type that is the (default) content property.
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
- Inheritance
-
ContentPropertyAttribute
- 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) |
Initializes a new instance of the ContentPropertyAttribute class. |
Properties
Name |
Gets the name of the content property |
Applies to
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET MAUI