Class FuncDataTemplate
Builds a control for a piece of data.
public class FuncDataTemplate : FuncTemplate<object?, Control?>, IRecyclingDataTemplate, IDataTemplate, ITemplate<object?, Control?>
- Inheritance
-
FuncDataTemplate
- Implements
- Derived
- Inherited Members
Constructors
FuncDataTemplate(Func<object?, bool>, Func<object?, INameScope, Control?>, bool)
Initializes a new instance of the FuncDataTemplate class.
public FuncDataTemplate(Func<object?, bool> match, Func<object?, INameScope, Control?> build, bool supportsRecycling = false)
Parameters
match
Func<object, bool>A function which determines whether the data template matches the specified data.
build
Func<object, INameScope, Control>A function which returns a control for matching data.
supportsRecycling
boolWhether the control can be recycled.
FuncDataTemplate(Type, Func<object?, INameScope, Control?>, bool)
Initializes a new instance of the FuncDataTemplate class.
public FuncDataTemplate(Type type, Func<object?, INameScope, Control?> build, bool supportsRecycling = false)
Parameters
type
TypeThe type of data which the data template matches.
build
Func<object, INameScope, Control>A function which when passed an object of
type
returns a control.supportsRecycling
boolWhether the control can be recycled.
Fields
Access
The default data template used in the case where no matching data template is found but AccessText should be used.
public static readonly FuncDataTemplate Access
Field Value
Default
The default data template used in the case where no matching data template is found.
public static readonly FuncDataTemplate Default
Field Value
Methods
Build(object?, Control?)
Creates or recycles a control to display the specified data.
public Control? Build(object? data, Control? existing)
Parameters
Returns
- Control
The
existing
control if supplied and applicable todata
, otherwise a new control or null.
Remarks
The caller should ensure that any control passed to existing
originated from the same data template.
Match(object?)
Checks to see if this data template matches the specified data.
public bool Match(object? data)
Parameters
data
objectThe data.
Returns
- bool
True if the data template can build a control for the data, otherwise false.