Skip to main content

InheritDataTypeFromItemsAttribute Class

Definition​

Assembly:Avalonia.Base
Package:Avalonia

Instructs the compiler to resolve the compiled bindings data type for the item-specific properties of collection-like controls.

public class InheritDataTypeFromItemsAttribute

Inheritance: Attribute -> InheritDataTypeFromItemsAttribute

Remarks​

A typical usage example is a ListBox control, where Avalonia.Metadata.InheritDataTypeFromItemsAttribute is defined on the ItemTemplate property, allowing the template to inherit the data type from the Items collection binding.

Constructors​

NameDescription
InheritDataTypeFromItemsAttributeInitializes a new instance of the Avalonia.Metadata.InheritDataTypeFromItemsAttribute class.

InheritDataTypeFromItemsAttribute Constructor​

Initializes a new instance of the Avalonia.Metadata.InheritDataTypeFromItemsAttribute class.

public InheritDataTypeFromItemsAttribute(string ancestorItemsProperty)

Parameters​

ancestorItemsProperty string

The name of the property whose item type should be used on the target property.

Properties​

NameDescription
AncestorItemsPropertyThe name of the property whose item type should be used on the target property.
AncestorTypeThe ancestor type to be used in a lookup for the Avalonia.Metadata.InheritDataTypeFromItemsAttribute.AncestorItemsProperty. If null, the declaring type of the target property is used.

AncestorItemsProperty Property​

The name of the property whose item type should be used on the target property.

public string AncestorItemsProperty { get; set; }

AncestorType Property​

The ancestor type to be used in a lookup for the Avalonia.Metadata.InheritDataTypeFromItemsAttribute.AncestorItemsProperty. If null, the declaring type of the target property is used.

public Type AncestorType { get; set; }