When i try to iterate through a populated WPF listview in order to remove a selected item, i get this weird, none sense of an error: cant cast string to listviewitem. (now I know what the error is implying, however; here is my code)
-
For each titem as listviewitem in listview1.items
-
if titem.isselected then listview1.items.remove(titem)
-
next
-
The error that I am getting is at the "for each line", (where titem iterates through the list. So my question is this: If my logic is correct and the coding is correct why am i getting that casting error when I am not dealing with strings?