Hi,
I wrote a component with a DesignOnly property. The property is a custom
dictionary (inheriting from DictionaryBase) that has a TypeConverter
to/from string type. Values are saved into and read from resource file
correctly when the containing form is saved/loaded.
The dictionary can be changed only by a custom editor. It acts as
a "stecialized property page". The editor starts a designer transaction,
calls OnComponentChanging()/OnCo0mponentChanged() and Commit() or
Cancel() at the end.
When OnComponentChanging() is called all properties are serialized for
undo/redo and Cancel(). The dictionary is accessed by
CodeDomSerializer.SerializePropertiesToResources() -- looks fine --
but the type converter of the dictionary is never called.
String properties of the same component (also DesignOnly) are treated
by VS properly: When i undo the last transaction organized by the
editor, they get old values assigned.
VS assignes something to the dictionary property also trying to undo changes,
but this is (a copy of) the same pointer to the dictiionary.
(Even object.ReferenceEquals() says "true".) May be that the pointer was
copied before the changes were done, but it is a pointer to the same
dictionary, that is changed now.
Only when I open the .resx window the converter is called. It is obvoius,
that without knowing how to [de]serialize my objects, VS can not support
undo/redo and only the converter knows how this should be done.
Can someone tell me, what I am doing wrong?
The converter is bound correctly to the property -- serializing and
deserializing into/from .resx prowes this.
Thanks,