tags:

views:

17

answers:

1

I have a Custom control extending Image, and I will put some more data on top of that image. However, when I am trying to style the component, I am getting the error that my Custom Control don't have the property Template. Error:

Cannot find the Style Property 'Template' on the type 'MyCustomImage'

How can I style my custom control if Image doesn't have a Template Property?

Thanks

Edit: Xaml:

<Style TargetType="{x:Type FieldComponents:MyCustomImage}">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type FieldComponents:MyCustomImage}">
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</style>
+2  A: 

Image inherits directly from FrameworkElement, not from Control, so it does not have a Template property. If you want to be able to template your control, you can inherit from Control or UserControl and have your template include an Image.

Quartermeister