WPF Listbox Show Button in ItemTemplate on MouseOver

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

    One solution to find what item was clicked is to add the following Event setter

    XAML

    C# void ListBoxItem_MouseEnter(object sender, MouseEventArgs e) { _memberVar = (sender as ListBoxItem).Content; }

提交回复
热议问题