1
我已經使用XAML完成了我的TreeView,但現在我想用代碼隱藏來管理事件,但我不知道如何。 HierarchicalDataTemplate包含一個Image。我需要捕獲圖像上的事件MouseEnter/MouseLeave。我已經試過這樣:捕獲WPF TreeViewItem中的圖像MouseEnter/MouseLeave
<Image x:Name="imgArticolo" Source="{Binding imgArt}">
<Image.Style TargetType="{x:Type Image}">
<Style>
<EventSetter Event="MouseEnter" Handler="iArt_MouseEnter"/>
</Style>
</Image.Style>
</Image>
但它不工作:錯誤:「的MouseEnter成員無法識別或無法訪問」(來自意大利)
你能,請幫助我嗎? 謝謝! Pileggi
最終的解決方案here:
非常感謝!它可以工作,但爲什麼在Visual Studio的設計器中出現錯誤:「不可能使用EventSetter加載文件XAML」。我該如何補救? 謝謝, Pileggi – lamarmora 2010-06-08 07:32:29
好的,你已經解決了我的問題在這個鏈接: http://stackoverflow.com/questions/2995730/eventsetter-error-xaml-in-visual-studio-designer – lamarmora 2010-06-08 16:28:34