Skip to content

Latest commit

 

History

History
32 lines (19 loc) · 1.46 KB

datatemplate_loadcontent_471913183.md

File metadata and controls

32 lines (19 loc) · 1.46 KB
-api-id -api-type
M:Microsoft.UI.Xaml.DataTemplate.LoadContent
winrt method

Microsoft.UI.Xaml.DataTemplate.LoadContent

-description

Creates the UIElement objects in the DataTemplate.

-returns

The root UIElement of the DataTemplate.

-remarks

When you call LoadContent, the UIElement objects in the DataTemplate are created, and you can add them to the visual tree of another UIElement.

-examples

The following examples demonstrate using the LoadContent method to change the appearance of a Border at run time. The example creates a ListView that contains the numbers 1 through 10. When the user selects an item in the ListView, the Border displays the selected number. If the user selects an even number, the number is red and has a green circle around it. If the user selects an odd number, the number is blue and has a purple square around it.

[!code-xamlSnippet2_XAML]

[!code-csharpSnippet2_CS]

-see-also