That all depends on the underlying collection container.  What are you
adding items to?  Most collections don't automatically sort for you when
you add new items.  If it's a SortedList, then it will.  If it's a list
that you can use an IComparer to sort (such as Array or ArrayList) then
you need to invoke the Sort method yourself. Otherwise, chances are new
items won't be sorted.

--Xavier

-----Original Message-----
From: Jay Glynn [mailto:[EMAIL PROTECTED]] 
Sent: Friday, August 09, 2002 11:07 AM
To: [EMAIL PROTECTED]
Subject: Re: [ADVANCED-DOTNET] IBindingList.ApplySort


I am/was calling the ListChangeEvent. The list sorts when I call
ApplySort, but a new object is added to the list, it is not sorted
properly. My understanding is that new objects added would be sorted to
the proper position.


On Thu, 8 Aug 2002 09:57:14 -0700, Xavier Musy
<[EMAIL PROTECTED]>
wrote:

>Make sure you fire the ListChanged event to notify bound controls or 
>listeners of the list sort:
>
>void IBindingList.ApplySort(PropertyDescriptor property, 
>ListSortDirection direction) {
>        // do sort here
>
>        ListChanged(this, new 
>ListChangedEventArgs(ListChangedType.Reset, null) }
>
>HTH,
>--Xavier
>

You can read messages from the Advanced DOTNET archive, unsubscribe from
Advanced DOTNET, or subscribe to other DevelopMentor lists at
http://discuss.develop.com.

You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced 
DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to