DataTemplate.GetElement(ElementFactoryGetArgs) Method
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.
Creates or retrieves an existing instance of the UIElement object declared in the DataTemplate.
UIElement GetElement(ElementFactoryGetArgs const& args);
public UIElement GetElement(ElementFactoryGetArgs args);
function getElement(args)
Public Function GetElement (args As ElementFactoryGetArgs) As UIElement
An instance of ElementFactoryGetArgs.
An instance of the root UIElement declared in the DataTemplate or null if the root of the DataTemplate is not a UIElement.
Device family |
Windows 10, version 1809 (introduced in 10.0.17763.0)
|
API contract |
Windows.Foundation.UniversalApiContract (introduced in v7.0)
|
The DataTemplate acts as a factory that generates the element object declared in its template. Unlike the LoadContent method that creates a new instance every time it is invoked, the GetElement method may either create a new instance or return an existing instance that was recycled via RecycleElement.
The DataTemplate's implementation of GetElement does not use the Data value from the ElementFactoryGetArgs. The Data property exists for implementations such as DataTemplateSelector where it is used to decide from which DataTemplate to load content.
Product | Versions |
---|---|
WinRT | Build 17763, Build 18362, Build 19041, Build 20348, Build 22000, Build 22621, Build 26100 |