Björn Marthen schrieb:
Hi,
I have written a custom web control with a DesignSerializer.
If i change a property in design-time, the serializer starts before the
properties will be set in the control (the object "value" in the serialize
method has the old property value). Thats annoying cause the serialize
should write somthing to the code that depends on the property.
Does anyone know a solution for my problem?
regards,
Björn Marthen
Hi Björn,
in the Method Serialize in your Serializer, the last parameter is your
control. you can access its properties and serialize values.
Public Overrides Function Serialize(ByVal manager As
System.ComponentModel.Design.Serialization.IDesign erSerializationManager,
ByVal value As Object) As Object
'ms-help://MS.VSCC.2003/MS.MSDNQTR.2003APR.1033/cpref/html/frlrfSystemComponentModelDesignSerializationCodeDo mSerializerClassTopic.htm
Dim BaseSerializer As CodeDomSerializer =
manager.GetSerializer(GetType(MyControl).BaseType,
GetType(CodeDomSerializer))
Dim codeObject As Object =
BaseSerializer.Serialize(manager, value)
Dim oMyControl As MyControl= CType(value, MyControl)
....
now you can serialize the code and use your control.