How can i can the Selected index of the listview when i double click on selected item ?
Also i have created a event DragEnter for the listview but due to this the double click event
is not firing.
So is there an开发者_StackOverflow社区y Idea regarding the same ?
thanks in advance. Manish.
Below works fine for me (even with DragEnter event handler):
private void listView1_DoubleClick (object sender, EventArgs e) {
if (listView1.SelectedIndices.Count > 0)
MessageBox.Show ("Selected Index is " + listView1.SelectedIndices[0]);
else
MessageBox.Show ("No item selected");
}
If I understand correctly you want to know the Index of the item that was double clicked, you can do this by handling the MouseDoubleClick
event and adding this code in the handler:
int index = listView1.HitTest(e.Location).Item.Index;
精彩评论