Suspend CollectionChanged event in BaseCollection class

J

Joe

Hello,

I have a class that inherits from BaseCollection. I want to implement a Move
method so an item in the collection can be moved from one index postion to
another for example index = 5 to index = 2.

I don't want the CollectionChanged event to get called when I remove the
item and do an Insert.

Is there anyway to suspend the event in my class that inherits from
BaseCollection?

Thanks,
Joe
 
J

Joe

Sorry it turned out this was our BaseCollection.

Peter Duniho said:
Can you clarify? The System.Windows.Forms.BaseCollection class doesn't
have a CollectionChanged event.

Pete
 
J

Jeffrey Tan[MSFT]

Hi Joe,

Thank you for the clarify. Then, do you still need any help on this issue?

Basically, since you implement the event yourself, you may use some private
flag to control if this event should be fired. When you are implementing
the "Move" method, you may set this flag, so that the all the internal
operations will honor this flag and will not fire CollectionChanged event.

Thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
=========================================
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top