capture MouseEnter / MouseLeave on Image in WPF TreeViewItem

Posted by pileggi on Stack Overflow See other posts from Stack Overflow or by pileggi
Published on 2010-06-07T21:55:09Z Indexed on 2010/06/07 22:32 UTC
Read the original article Hit count: 430

Filed under:

Hi!

I've done my TreeView all with XAML but now I'd like to manage an event with code-behind and I don't know how. The HierarchicalDataTemplate contains an Image. I need to capture the events MouseEnter / MouseLeave on the Image. I've tried in this way:

<Image x:Name="imgArticolo" Source="{Binding imgArt}">
    <Image.Style TargetType="{x:Type Image}">
        <Style>
            <EventSetter Event="MouseEnter" Handler="iArt_MouseEnter"/>
        </Style>
    </Image.Style>
</Image>

But it doesn't work: error: "MouseEnter member not recognized or not accessible" (from italian)

Can you, please, help me? Thank you! Pileggi

© Stack Overflow or respective owner

Related posts about wpf