TemplatePartAttribute Class
Definition
Defines a control template part referenced by name in code. Template part names should begin with the "PART_" prefix.
public class TemplatePartAttribute
Remarks
Style authors should be able to identify the part type used for styling the specific control. The part is usually required in the style and should have a specific predefined name.
Constructors
| Name | Description |
|---|---|
| TemplatePartAttribute (2 overloads) | Initializes a new instance of the Avalonia.Controls.Metadata.TemplatePartAttribute class. |
TemplatePartAttribute overloads
TemplatePartAttribute Constructor
Initializes a new instance of the Avalonia.Controls.Metadata.TemplatePartAttribute class.
public TemplatePartAttribute()
TemplatePartAttribute Constructor
Initializes a new instance of the Avalonia.Controls.Metadata.TemplatePartAttribute class.
public TemplatePartAttribute(string name, Type type)
Parameters
name string
The part name used by the class to identify a required element in the style.
type Type
The type of the element that should be used as a part with name.
Properties
| Name | Description |
|---|---|
| IsRequired | Gets or sets a value indicating whether the template part is mandatory to be present in the template. |
| Name | Gets or sets the part name used by the class to identify a required element in the style. Template part names should begin with the "PART_" prefix. |
| Type | Gets or sets the type of the element that should be used as a part with name specified in Avalonia.Controls.Metadata.TemplatePartAttribute.Name. |
IsRequired Property
Gets or sets a value indicating whether the template part is mandatory to be present in the template.
public bool IsRequired { get; set; }
Name Property
Gets or sets the part name used by the class to identify a required element in the style. Template part names should begin with the "PART_" prefix.
public string Name { get; set; }
Type Property
Gets or sets the type of the element that should be used as a part with name specified in Avalonia.Controls.Metadata.TemplatePartAttribute.Name.
public Type Type { get; set; }