Get Template Child(String) Method
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.
protected: virtual DependencyObject ^ GetTemplateChild(Platform::String ^ childName) = GetTemplateChild;
DependencyObject GetTemplateChild(winrt::hstring const& childName);
protected DependencyObject GetTemplateChild(string childName);
Protected Function GetTemplateChild (childName As String) As DependencyObject
The name of the element to find.
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.
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.
Submit and view feedback for