Skip to content

Latest commit

 

History

History
30 lines (20 loc) · 1.21 KB

control_gettemplatechild_501346084.md

File metadata and controls

30 lines (20 loc) · 1.21 KB
-api-id -api-type
M:Windows.UI.Xaml.Controls.Control.GetTemplateChild(System.String)
winrt method

Windows.UI.Xaml.Controls.Control.GetTemplateChild

-description

Retrieves the named element in the instantiated ControlTemplate visual tree.

-parameters

-param childName

The name of the element to find.

-returns

The named element from the template, if the element is found. Can return null if no element with name childName was found in the template.

-remarks

You call GetTemplateChild to get references to objects in a controls Template after it's instantiated. The ControlTemplate is instantiated in the OnApplyTemplate method. You can use the GetTemplateChild method inside your OnApplyTemplate override and keep a reference to the objects you need.

-examples

-see-also

OnApplyTemplate