Hi,
Thank you for your reply, I am glad that you were able to reproduce the
problem.
The ListView control is, by default, in a multi-selection mode and we are
using it as such. The SelectedIndices property should correctly reflect the
change in selection when the event is raised, no matter how the change
occured.
The event title, SelectedIndexChanged, suggests a past tense. By this I
mean, when the event is raised, the selected indices should have already
changed and the value of the SelectedIndices property should correctly
reflect this change. By having a situation where, in some circumstances, the
SelectedIndices value is not correct when the control is notifying listeners
that there has been a change, is simply not the correct behavior. One would
expect a final SelectedIndexChanged event where the SelectedIndices property
was in sync with the actual selections made.
CJL
> Hi CJL,
>
[quoted text clipped - 25 lines]
> Linda Liu
> Microsoft Online Community Support
Linda Liu [MSFT] - 09 Oct 2006 10:57 GMT
Hi CJL,
Thank you for your update.
Firstly, I would appologize to you that I made a mistake in my previous
reply.
The SelectedIndexChanged event occurs in single selection ListView
controls, whenever there is a change to the index position of the selected
item. In a multiple selection ListView control, this event occurs whenever
an item is removed or added to the list of selected items.
If the ListView control is not in virtual mode, the SelectedIndexChanged
event works, no matter we select a single item or select multiple items
using Ctrl or Shift key.
If the ListView is in virtual mode, the SelectedIndexChanged event works
when we select a single item or select multiple items using Ctrl key. If we
use Shift key to select a range of items, this event won't occur after the
selection finishes, but another event called
VirtualItemsSelectionRangeChanged will be raised. So we should handle this
event to get the correct value of the SelectedIndices property of the
ListView control.
Hope this helps.
If you have anything unclear, please feel free to let me know.
Sincerely,
Linda Liu
Microsoft Online Community Support
Linda Liu [MSFT] - 11 Oct 2006 13:56 GMT
Hi CJL,
How about the problem now?
If you have anything unclear, please feel free to let me know.
Thank you for using our MSDN Managed Newsgroup Support Service!
Sincerely,
Linda Liu
Microsoft Online Community Support
dcolak@gmail.com - 20 Oct 2006 04:22 GMT
Does anyone have a working code that shows how to get the list of
selected items when the ListView is in virtual mode?
I mean, please, we just want to get the list of items selected in a
list view!!! How hard should it be?!
Thanks.
Sincerely,
Damir Colak
Very Frustrated Developer
> Hi CJL,
>
[quoted text clipped - 7 lines]
> Linda Liu
> Microsoft Online Community Support