views:

73

answers:

1

Hello

I created a named style on an image, and in the style I set an EventBinding for the MouseDown event to a handler at the ResourceDictionary's code-behind, it worked good. When I use the image as the following:

<Style TargetType="{x:Type Image}" x:Key="ImageStyle">
    <EventSetter Event="MouseDown" Handler="Image_MouseDown"/>
</Style>
<!---->
<Image Style="{StaticResource ImageStyle}">
    <Image.InputBindings>
        <MouseBinding Command="Save" MouseAction="LeftClick"/>
    </Image.InputBindings>
</Image>

It causes the styled MouseDown eventbinding not to work.

A: 

It's hard to say without the style code, but I suppose you're defining InputBindings property in that style, then the Image setting just override it. Whatever you set in the actual element XAML overrides whatever you define in that element's style.

If that's the case, there's no easy way to merge style properties with the actual properties.

HTH.

Yacoder