5

I am creating some custom controls in WPF and need to therefore create the default control templates for them. To help in this process I would like to see the XAML of the control templates for the builtin controls as a reference.

I can open up the PresentationFramework.Class dll into .NET Reflector but cannot find anything inside it of use. It seems to have only BAML but not the original XAML.

Is this available online somewhere? Or is there a tool that can extract it?

Phil Wright
  • 22,580
  • 14
  • 83
  • 137
  • See also "Where can I download Microsoft's standard WPF themes from?" http://stackoverflow.com/questions/4158678/where-can-i-download-microsofts-standard-wpf-themes-from – sourcenouveau Nov 16 '10 at 15:08
  • If sample control template are inadequate, you can find the default WPF themes here: [http://go.microsoft.com/fwlink/?LinkID=158252](http://go.microsoft.com/fwlink/?LinkID=158252) – kevinarpe Oct 13 '12 at 09:13

4 Answers4

10

If you have Expression Blend installed several themes, including classic.xaml, can be found in

C:\Program Files\Microsoft Expression\Blend 3\SystemThemes\Wpf

ChrisF
  • 134,786
  • 31
  • 255
  • 325
  • 2
    If you have the Windows SDK installed they are also available in C:\Program Files\Microsoft SDKs\Windows\v6.1\Samples\WPFSamples.zip in the Core folder e.g. Core\ClassicTheme\xaml\classic.xaml – Phil Devaney Sep 21 '09 at 11:45
  • 2
    You can download these files directly from MSDN, without Blend: http://msdn.microsoft.com/en-us/library/aa358533.aspx – sourcenouveau Mar 08 '10 at 15:51
8

If you need to build new templates the sample control templates at http://msdn.microsoft.com/en-us/library/aa970773.aspx are often a better starting point.

The actual themes included with WPF are not designed to be extendable or understandable

Nir
  • 29,306
  • 10
  • 67
  • 103
3

The BAML to XAML Viewer add-in for Reflector can extract the BAML, convert it to XAML and you can also save it to file.

Daniel May
  • 8,156
  • 1
  • 33
  • 43
2

Check out StyleSnooper. It allows you to pick any of the inbuilt controls and dump out the default style xaml.

(You can also do this from Expression Blend if you have it.)

Simon P Stevens
  • 27,303
  • 5
  • 81
  • 107
  • Snoop can also do this - very lightweight, easy to use and has a few other features such as 3D zooming and heirarchy views: http://blois.us/Snoop/ – Daniel May Sep 21 '09 at 10:50