ListView SelectedIndexChanged trouble getting SelectedItems
Posted on 2006-06-03
I'm handleing the correct event when the user changes the selected item, but when I go and try to get that item, I'm getting null. I use
private ListViewItem GetSelection( ListView listView )
foreach ( ListViewItem listViewItem in listView.SelectedItems )
to get the one and on y choice in my single selection ListView. I know there's a better way to do this, and if you have it I'd love to see it. But the problem is that there the foreach does not get entered into, even thoiugh I only call this function when the user has selected an item in the ListView. Can anybody suggest a solution?