For the wpf listview , in the Mouse Over event how do i get a reference to the item that the mouse cursor is on开发者_如何学Go ?
Regards, MadSeb
You have to use the MouseOver event from the listViewItem that the mouse is over, not the one from the listview itself.
public MainWindow() {
InitializeComponent();
ListView listView = new ListView();
ListViewItem listViewItem = new ListViewItem();
listViewItem.MouseMove += myMouseMoveEvent;
listView.Items.Add(listViewItem);
}
private void myMouseMoveEvent(object sender, MouseEventArgs e) {
ListViewItem item = (ListViewItem) sender;
// now you can handle the events with this item....
}
精彩评论