How to: Find ControlTemplate-Generated Elements
Collapse the table of content
Expand the table of content

How to: Find ControlTemplate-Generated Elements

 

This example shows how to find elements that are generated by a ControlTemplate.

Example

The following example shows a style that creates a simple ControlTemplate for the Button class:

To find an element within the template after the template has been applied, you can call the FindName method of the Template. The following example creates a message box that shows the actual width value of the Grid within the control template:

Show:
© 2016 Microsoft