Skip to main content

FindDataTemplate Method

Find a data template that matches a piece of data.

Definition​

Namespace: Avalonia.Controls.Templates
Assembly: Avalonia.Controls (in Avalonia.Controls.dll)

public static IDataTemplate? FindDataTemplate(
this Control control,
Object data,
IDataTemplate primary = null
)

Parameters​

  Control
The control searching for the data template.
  Object
The data.
  IDataTemplate  (Optional)
An optional primary template that can will be tried before the DataTemplates in the tree are searched.

Return Value​

IDataTemplate
The data template or null if no matching data template was found.

Usage Note​

In Visual Basic and C#, you can call this method as an instance method on any object of type Control. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

See Also​

Reference​

DataTemplateExtensions Class
Avalonia.Controls.Templates Namespace