#724 – Sample Code for Examining Control Templates

Charles Petzold, in his book Applications = Code + Markup, includes lots of useful sample code.  In chapter 25, talking about templates, he presents source code for a DumpControlTemplate project.  You can find the source code at http://www.microsoft.com/mspress/companion/0-7356-1957-3/.   Download the code samples and then look for the DumpControlTemplate project under chapter 25.

You start by selecting a control from the Control menu.



Once you select a control, the application will render the control in the top half of the window.  You can then select the template that you want to see from the Dump menu.  For example, we can choose to see the control template for a Button.



After you select the desired template, the XAML for that template is displayed in the main window.



(Note that you can select text in this window, right-click and select Copy).


About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: