Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > .NET General

Vista - ListBox vs. ListView

Reply
 
Old 11-18-2008   #1 (permalink)
Mike


 
 

ListBox vs. ListView

Is there a way to get a ListView control to fire its
SelectedIndexChanged event like the ListBox control? When the user
selects multiple items at once, the ListView fires the event as each
item gets selected. The ListBox waits to fire the event until all
selections are complete.

Thanks,
Mike

My System SpecsSystem Spec
Old 11-18-2008   #2 (permalink)
Jeff Johnson


 
 

Re: ListBox vs. ListView

"Mike" <MLM450@xxxxxx> wrote in message
news:26ddc286-ef50-4ddf-a65e-f1fe2a828e4f@xxxxxx
Quote:

> Is there a way to get a ListView control to fire its
> SelectedIndexChanged event like the ListBox control? When the user
> selects multiple items at once, the ListView fires the event as each
> item gets selected. The ListBox waits to fire the event until all
> selections are complete.
It does? How do it KNOW that the selections are complete?

(I, for one, welcome our new telepathic list box overlords....)


My System SpecsSystem Spec
Old 11-18-2008   #3 (permalink)
Mike


 
 

Re: ListBox vs. ListView

On Nov 18, 4:32*pm, "Jeff Johnson" <i....@xxxxxx> wrote:
Quote:

> "Mike" <MLM...@xxxxxx> wrote in message
>
> news:26ddc286-ef50-4ddf-a65e-f1fe2a828e4f@xxxxxx
>
Quote:

> > Is there a way to get a ListView control to fire its
> > SelectedIndexChanged event like the ListBox control? When the user
> > selects multiple items at once, the ListView fires the event as each
> > item gets selected. The ListBox waits to fire the event until all
> > selections are complete.
>
> It does? How do it KNOW that the selections are complete?
>
> (I, for one, welcome our new telepathic list box overlords....)
How could it not know? If I click on the first of 100 items and then
shift-click the last item, I think the control needs to know it is
selecting all 100 items or else how could it do it?
My System SpecsSystem Spec
Old 11-18-2008   #4 (permalink)
Jeff Johnson


 
 

Re: ListBox vs. ListView

"Mike" <MLM450@xxxxxx> wrote in message
news:c1b951c7-c1f7-4ea7-988e-8dde7ab588b7@xxxxxx
Quote:
Quote:
Quote:

>>> Is there a way to get a ListView control to fire its
>>> SelectedIndexChanged event like the ListBox control? When the user
>>> selects multiple items at once, the ListView fires the event as each
>>> item gets selected. The ListBox waits to fire the event until all
>>> selections are complete.
>
Quote:

>> It does? How do it KNOW that the selections are complete?
>
Quote:

>> (I, for one, welcome our new telepathic list box overlords....)
Quote:

> How could it not know? If I click on the first of 100 items and then
> shift-click the last item, I think the control needs to know it is
> selecting all 100 items or else how could it do it?
Well, you didn't specify what type of multi-selection you were using.
There's also the type where you can Ctrl+click items, and do it as many
times as you want.

And you're saying that the first click (on the "anchor" item) doesn't fire
SelectedIndexChanged? I'm having difficulty believing that.


My System SpecsSystem Spec
Old 11-18-2008   #5 (permalink)
Jeff Johnson


 
 

Re: ListBox vs. ListView

"Jeff Johnson" <i.get@xxxxxx> wrote in message
news:uE0QsjcSJHA.5860@xxxxxx
Quote:
Quote:
Quote:

>>>> Is there a way to get a ListView control to fire its
>>>> SelectedIndexChanged event like the ListBox control? When the user
>>>> selects multiple items at once, the ListView fires the event as each
>>>> item gets selected. The ListBox waits to fire the event until all
>>>> selections are complete.
>>
Quote:

>>> It does? How do it KNOW that the selections are complete?
>>
Quote:

>>> (I, for one, welcome our new telepathic list box overlords....)
>
Quote:

>> How could it not know? If I click on the first of 100 items and then
>> shift-click the last item, I think the control needs to know it is
>> selecting all 100 items or else how could it do it?
>
> Well, you didn't specify what type of multi-selection you were using.
> There's also the type where you can Ctrl+click items, and do it as many
> times as you want.
>
> And you're saying that the first click (on the "anchor" item) doesn't fire
> SelectedIndexChanged? I'm having difficulty believing that.
Oh, wait, you're saying you only want two event firings: the first and the
last. I think the behavior you're seeing is due to the fact that the list
view is far more complicated than the list box. For example, the list items
are not necessarily in the same order that you see them, and they're
independent objects as well, so the list view has to notify them that
they've been selected and they in turn probably raise an event which the
list box passes on. (This is speculation, of course.)

So here's the real question: would it be that hard to change your code to
deal with it? Are you updating your UI dynamically based on the selections?


My System SpecsSystem Spec
Old 11-18-2008   #6 (permalink)
Mike


 
 

Re: ListBox vs. ListView

On Nov 18, 5:14*pm, "Jeff Johnson" <i....@xxxxxx> wrote:
Quote:

> "Jeff Johnson" <i....@xxxxxx> wrote in message
>
> news:uE0QsjcSJHA.5860@xxxxxx
>
>
>
>
>
Quote:
Quote:

> >>>> Is there a way to get a ListView control to fire its
> >>>> SelectedIndexChanged event like the ListBox control? When the user
> >>>> selects multiple items at once, the ListView fires the event as each
> >>>> item gets selected. The ListBox waits to fire the event until all
> >>>> selections are complete.
>
Quote:
Quote:

> >>> It does? How do it KNOW that the selections are complete?
>
Quote:
Quote:

> >>> (I, for one, welcome our new telepathic list box overlords....)
>
Quote:
Quote:

> >> How could it not know? If I click on the first of 100 items and then
> >> shift-click the last item, I think the control needs to know it is
> >> selecting all 100 items or else how could it do it?
>
Quote:

> > Well, you didn't specify what type of multi-selection you were using.
> > There's also the type where you can Ctrl+click items, and do it as many
> > times as you want.
>
Quote:

> > And you're saying that the first click (on the "anchor" item) doesn't fire
> > SelectedIndexChanged? I'm having difficulty believing that.
>
> Oh, wait, you're saying you only want two event firings: the first and the
> last. I think the behavior you're seeing is due to the fact that the list
> view is far more complicated than the list box. For example, the list items
> are not necessarily in the same order that you see them, and they're
> independent objects as well, so the list view has to notify them that
> they've been selected and they in turn probably raise an event which the
> list box passes on. (This is speculation, of course.)
>
> So here's the real question: would it be that hard to change your code to
> deal with it? Are you updating your UI dynamically based on the selections?- Hide quoted text -
>
> - Show quoted text -
Yeah, what you are saying about the cause makes sense. I could change
things to handle how it works, I was just hoping there was a simple
property or something somewhere that would make it work like the list
box. I'd rather not use the list box for other reasons I won't get
into here.
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Easy to get handle from listbox. How to get listbox from handle? .NET General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46