Robert Fraser
Robert Fraser

Reputation: 10927

Making default control template editable in Expression blend

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?

Upvotes: 1

Views: 1235

Answers (1)

Arcturus
Arcturus

Reputation: 27055

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>

Upvotes: 2

Related Questions