我已经用XAML完成了我的TreeView,但现在我想通过代码后台来管理事件。HierarchicalDataTemplate包含一个图像。我需要捕获图像上的MouseEnter / MouseLeave事件。我尝试过以下方法:
<Image x:Name="imgArticolo" Source="{Binding imgArt}">
<Image.Style>
<Style TargetType="{x:Type Image}">
<EventSetter Event="MouseEnter" Handler="iArt_MouseEnter"/>
</Style>
</Image.Style>
</Image>
但是在Visual Studio的设计师中出现了错误:“无法加载带有EventSetter的XAML文件”。
我该怎么办?谢谢! Pileggi