M
m. pollack
Hi all,
I'm still trying to get to the bottom of the problem I am
having with the CollectionBase class and the Object
Collection Editor.
Briefly put, I am exposing a strongly-typed collection
property, using a class derived from CollectionBase, to
the user via the PropertyGrid control's popup Collection
Editor. I need to know when the user has added or removed
objects to the collection. In my collection class I am
implementing the collection interface's Add, Insert,
Remove, and RemoveAt methods, but the Collection Editor
does not seem to call these implemented methods to
manipulate the list. There are some "hook" methods
provided, namely OnInsert, OnInsertComplete, OnRemove, and
OnRemoveComplete, so I tried overriding those methods. If
the user adds to the collection with the Collection
Editor, the OnInsert hook is called, but the OnRemove
method is not called when an object is removed. I can find
absolutely no documentation about this problem, and as far
as my application is concerned it's kind of a show-stopper.
A few people replied to my previous post, but I still have
not found a way around the problem. JD posted that the IL
did in fact seem to be calling the On Remove and
OnRemoveComplete methods, but it sure doesn't seem to be
working when I try it. Mick Doherty posted that the
CollectionEditor might be destroying and recreating the
whole list, and thereby bypassing this code... does
anybody know what is going on with this thing?
Many thanks, MP
I'm still trying to get to the bottom of the problem I am
having with the CollectionBase class and the Object
Collection Editor.
Briefly put, I am exposing a strongly-typed collection
property, using a class derived from CollectionBase, to
the user via the PropertyGrid control's popup Collection
Editor. I need to know when the user has added or removed
objects to the collection. In my collection class I am
implementing the collection interface's Add, Insert,
Remove, and RemoveAt methods, but the Collection Editor
does not seem to call these implemented methods to
manipulate the list. There are some "hook" methods
provided, namely OnInsert, OnInsertComplete, OnRemove, and
OnRemoveComplete, so I tried overriding those methods. If
the user adds to the collection with the Collection
Editor, the OnInsert hook is called, but the OnRemove
method is not called when an object is removed. I can find
absolutely no documentation about this problem, and as far
as my application is concerned it's kind of a show-stopper.
A few people replied to my previous post, but I still have
not found a way around the problem. JD posted that the IL
did in fact seem to be calling the On Remove and
OnRemoveComplete methods, but it sure doesn't seem to be
working when I try it. Mick Doherty posted that the
CollectionEditor might be destroying and recreating the
whole list, and thereby bypassing this code... does
anybody know what is going on with this thing?
Many thanks, MP