Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

DataTemplate Class

Definition

Namespace:
Microsoft.Maui.Controls
Assembly:
Microsoft.Maui.Controls.dll
Source:
DataTemplate.cs
Source:
DataTemplate.cs
Source:
DataTemplate.cs
Source:
DataTemplate.cs

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Defines the visual structure for templated items. Used to display data objects with a consistent appearance.

public ref class DataTemplate : Microsoft::Maui::Controls::ElementTemplate, Microsoft::Maui::Controls::Internals::IDataTemplateController
public class DataTemplate : Microsoft.Maui.Controls.ElementTemplate, Microsoft.Maui.Controls.Internals.IDataTemplateController
type DataTemplate = class
 inherit ElementTemplate
 interface IDataTemplateController
Public Class DataTemplate
Inherits ElementTemplate
Implements IDataTemplateController
Inheritance
DataTemplate
Derived
Implements

Remarks

In XAML, application developers can nest markup inside a DataTemplate tag to create a View whose members are bound to the properties of data objects that are contained in a ItemsSource list.

Constructors

Name Description
DataTemplate()

Initializes a new instance of the DataTemplate class.

DataTemplate(Func<Object>)

Initializes a new instance with a factory function that creates template content.

DataTemplate(Type)

Initializes a new instance of the DataTemplate class with the specified type.

Properties

Name Description
Bindings

Gets the dictionary of bindings to apply to templated items.

LoadTemplate (Inherited from ElementTemplate)
Values

Gets the dictionary of property values to apply to templated items.

Methods

Name Description
CreateContent()

Used by the XAML infrastructure to load data templates and set up the content of the resulting UI.

(Inherited from ElementTemplate)
SetBinding(BindableProperty, BindingBase)

Sets a binding for a property on templated items.

SetValue(BindableProperty, Object)

Sets a static value for a property on templated items.

Explicit Interface Implementations

Name Description
IDataTemplateController.Id
IDataTemplateController.IdString

Extension Methods

Name Description
CreateContent(DataTemplate, Object, BindableObject)

Selects the appropriate template and creates its content for the specified item.

SelectDataTemplate(DataTemplate, Object, BindableObject)

Returns the appropriate template, invoking selector logic if the template is a DataTemplateSelector.

SetBinding(DataTemplate, BindableProperty, String)

Creates a binding on the template for the specified property and path.

Applies to


Feedback

Was this page helpful?