Search code examples
c#listviewimagelist

ImageList in a ListView


I have an image list in a list view where previously the only images displayed were pdf's. This meant that that i could handle the double click event effectively to open pdf's. Now i have a different requirement to display some place holder thumbnails for other files in a folder. Is there a way in the listView_DoubleClick event to determine what picture was clicked in the image list, that way i can determine how to handle the event?

Thanks for your time


Solution

  • Determine what item was clicked, when you then have a ListViewItem instance you can check for the ListViewItem.ImageIndex property.

    Edit: ListView.SelectedItem and/or ListView.SelectedItems are your friends here.