How to access a WPF control located in a ControlTemplate?

You can use the FindName() method of the ControlTemplate class.

// Finding the grid that is generated by the ControlTemplate of the Button
Grid gridInTemplate = (Grid)myButton1.Template.FindName("grid", myButton1);

Leave a Comment