views:

241

answers:

1

I created my own ContentCOntrol in XAML, e.x.:

<ContentControl x:Class="server.ui.DiamondButton">
    <ContentControl.Template>
        <ControlTemplate TargetType="src:DiamondButton">
            <...>
        </ControlTemplate>
    </ContentControl.Template>
</ContentControl>

This sets the default template and generally works great. However, the template is not editable in Expression. I get the message 'DiamondButton' ControlTemplate TargetType does not match templated type 'ContentControl'. Is there another way I should be doing this which allows it to be editable in Blend?

+2  A: 

Unless you use specific properties from your DiamondButton in TemplateBindings in your ControlTemplate, changing the TargetType src:DiamondButton to ContentControl should do the trick ;)..

<ContentControl x:Class="server.ui.DiamondButton">
    <ContentControl.Template>
        <ControlTemplate TargetType="ContentControl">
            <...>
        </ControlTemplate>
    </ContentControl.Template>
</ContentControl>
Arcturus
Thanks, but, yeah, I do bind to special properties of DiamondButton (the purpose of the class is really to wrap these properties, otherwise I would be using a styled Button).
Robert Fraser
Hmm.. thats too bad ;).. Have you already tried the Type markup tag for TargetType {x:Type src:DiamondButton} ?
Arcturus
Yup; that's the same thing. It's okay; I do most of my editing in XAML anyway ;-P.
Robert Fraser
if you need to bind to special properties of the diamondbutton you can do this by fully qualifying the property name: `<Trigger Property="IsClicked"` becomes `<Trigger Property="server.ui.DiamondButton.IsClicked"`
Rob Fonseca-Ensor