views:

172

answers:

3

Does anyone know where to find a list of controls that you can set the template on in Silverlight? I've wasted several hours now trying to create control templates only to find that the control doesn't support the template property.

By "doesn't support" I mean:

<Style x:Key="blah" TargetType="Border">
    <Setter Property="Template">

Throws an error saying "Invalid attribute value Template for property Property".

I now know that I can't create a template for TextBlocks or Borders. Is there a definitive list somewhere? It's not on Microsoft's site as far as I can tell.

Thanks!

+2  A: 

Anything that extends Control

http://msdn.microsoft.com/en-us/library/system.windows.controls.control%28VS.96%29.aspx

James Hay
Thank you. I'm embarrassed to say that I only now noticed the note box on the page where it says this:http://msdn.microsoft.com/en-us/library/cc189093(VS.95).aspx#when_should_you_create_a_controltemplate
Klay
This is correct, except for the one exception of UserControl (and anything deriving from UserControl). It has a Template property (because it derives from Control), but that property is not actually usable.
KeithMahoney
A: 

Classes that inherit from Control have templates, classes that inherit from FrameworkElement do not.

If you look at the docs for Border you will see it inherits from FrameworkElement.

Bryant
A: 

This link Control Styles and Templates is also really useful because it lets you dive into what the default templates look like. This is a vital resource if you really want to completely override the visuals of a control.

AnthonyWJones