Template Browser – an indispensible tool

SLLogoWords

Follow up posted at bottom of article

One way that many developers like to create styles and templates for controls is to modify the existing styles and templates. An unusual feature of Silverlight is that every control in the toolbox is lookless – its appearance is determined by its own generic.xaml, just like the custom controls you create.  

Finding this generic.xaml can be a bit tricky, as it is stored in a specially named resource file, but it is all documented on MSDN.  That would be pretty good, but David Anson (aka "Delay") has created a wonderful desktop tool for inspecting (and copying) the styles and templates of the Silverlight controls

 TemplateBrowser
(Click on image for full size)

This is a really nice piece of work, allowing you to expand and collapse and spelunk the templates and styles and also to copy either or both to the clipboard to bring into your own code. I’ve added the circles and arrows to point out that the outline of elements is entirely collapsible and that the bottom of the browser offers a number of useful options.

I find this particularly useful in finding best practices for working around apparent limitations such as the changes to the ContentPresenter discussed on Sept 28.

Note that the link to the standalone tool includes the source code – but the program was written in WPF, not Silverlight.  If you want the Clickonce version, you’ll want this link.

Follow link to related artcile

 
More Templates and Custom Controls

Share

About Jesse Liberty

Jesse Liberty is an independent consultant and programmer with three decades of experience writing and delivering software projects. He is the author of 2 dozen books and multiple Pluralsight courses, and has been a Senior Technical Evangelist for Microsoft, a Distinguished Software Engineer for AT&T, a VP for Information Services for Citibank and a Software Architect for PBS. He is a Xamarin Certified Mobile Developer and a Xamarin MVP, Microsoft MVP and Telerik MVP.
This entry was posted in z Silverlight Archives. Bookmark the permalink.

Leave a Reply

Your email address will not be published.