Skip to main content

FuncDataTemplate Class

Definition

Assembly:Avalonia.Controls
Package:Avalonia

Builds a control for a piece of data.

public class FuncDataTemplate

Inheritance: FuncTemplate<object,Control> -> FuncDataTemplate

Implements: IDataTemplate, IRecyclingDataTemplate, ITemplate<object,Control>

Constructors

NameDescription
FuncDataTemplate (2 overloads)No summary available.

FuncDataTemplate overloads

FuncDataTemplate Constructor

public FuncDataTemplate(Func<object, bool> match, Func<object, Avalonia.Controls.INameScope, Avalonia.Controls.Control> build, bool supportsRecycling)
Parameters

match Func<object, bool>

build Func<object, Avalonia.Controls.INameScope, Avalonia.Controls.Control>

supportsRecycling bool

FuncDataTemplate Constructor

public FuncDataTemplate(Type type, Func<object, Avalonia.Controls.INameScope, Avalonia.Controls.Control> build, bool supportsRecycling)
Parameters

type Type

build Func<object, Avalonia.Controls.INameScope, Avalonia.Controls.Control>

supportsRecycling bool

Methods

NameDescription
BuildCreates or recycles a control to display the specified data.
MatchChecks to see if this data template matches the specified data.

Build Method

Creates or recycles a control to display the specified data.

public Avalonia.Controls.Control Build(object data, Avalonia.Controls.Control existing)

Parameters

data object

The data to display.

existing Avalonia.Controls.Control

An optional control to recycle.

Returns

Avalonia.Controls.Control

The existing control if supplied and applicable to data, otherwise a new control or null.

Remarks

The caller should ensure that any control passed to existing originated from the same data template.

Match Method

Checks to see if this data template matches the specified data.

public bool Match(object data)

Parameters

data object

The data.

Returns

bool

True if the data template can build a control for the data, otherwise false.

Fields

NameDescription
AccessThe default data template used in the case where no matching data template is found but Avalonia.Controls.Primitives.AccessText should be used.
DefaultThe default data template used in the case where no matching data template is found.

Access Field

The default data template used in the case where no matching data template is found but Avalonia.Controls.Primitives.AccessText should be used.

public Avalonia.Controls.Templates.FuncDataTemplate Access

Default Field

The default data template used in the case where no matching data template is found.

public Avalonia.Controls.Templates.FuncDataTemplate Default