WPF Listbox Show Button in ItemTemplate on MouseOver

后端 未结 5 1512
既然无缘
既然无缘 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:10

    Ok, try this in your button declaration:

    
    

    So I'm using a style with a trigger to look back up the visual tree until I find a ListBoxItem, and when its IsMouseOver property flips over to True I set the button's visibility to Visible.

    See if it's close to what you want.

提交回复
热议问题