ControlTemplate for existing controls in WPF

If you have Expression Blend you can:

  1. Drag the control onto the design surface
  2. Right click the control and choose Edit Template -> Edit Copy

When you do this, Blend will extract the base template from the control and explicitly declare it within document/application as a resource which you can then edit to your liking. You can do this for any control.


The book "Pro WPF in C# 2008", by Matthew MacDonald, includes a Control Template browser in Chapter 15. I believe you can simply download the sample code from the Apress web site.


The styles along with template examples are up on MSDN for download, see the Default WPF Themes link.

However you can also extend the existing style without redefining everything by using the BasedOn attribute.


Check out StyleSnooper:

enter image description here

It will dump out the standard styles (and therefore templates too) for the built in controls. You can also load in a specific DLL that contains WPF controls and view the default styles for those too.