9

This seems like it should be something fairly simple, but I just can't seem to get it to work.

I'd like to programatically clear the selection of the currently selected item in my ListView.

I've tried setting SelectedValue to null, setting SelectedItem to null, setting the SelectedIndex to -1, and even tried calling the UnselectAll method. In each and every case, SelectedItems.Count is still equal to one...

Any ideas?

Sonny Boy
  • 7,848
  • 18
  • 76
  • 104

1 Answers1

26

You must put it into an empty collection

ListView.UnselectAll();

I have read the question again. If it does not work, then the problem may be with binding. Is the ListView bound??

Gallal
  • 4,267
  • 6
  • 38
  • 61
PRASHANT P
  • 1,527
  • 1
  • 16
  • 28