WPF Listbox Show Button in ItemTemplate on MouseOver

后端 未结 5 1502
既然无缘
既然无缘 2020-12-23 09:56

I have a listbox containing and image and a button. By default the button is hidden. I want to make the button visible whenever I hover over an item in the listbox. The XAML

5条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-23 10:24

    @David is showing the right way, But I have one suggestion to your XAML architecture. If you don't have any DataBinding on the Button it is better to put that in to the ListBoxItem style than the DataTemplate as bellow.

      
    

提交回复
热议问题