I have build a similar sample, based upon same sample code for dynamic properties; if I follow your advice, the error indeed dissapears but another one pops up. (Not sure is that's the case in the original sample though.)
The error I get is: Error 2 Could not deserialize object. Serializer for type 'Samples.myActivity' threw an exception during deserialization. Exception was thrown with error message 'Type 'System.Workflow.ComponentModel.WorkflowParameterBindingCollection' for dependency property 'ParameterBindings' does not match with value type 'System.Workflow.ComponentModel.WorkflowParameterBinding'. Parameter name: value'.
My serialized xoml looks like:
< ns0:myActivity x:Name="WriteTextAndInteger" MyBooleanProperty="False">
< ns0:myActivity .ParameterBindings>
< WorkflowParameterBinding ParameterName="MySampleTextData">
< WorkflowParameterBinding.Value>
< ns1:String xmlns:ns1="clr-namespace:System;Assembly=mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">test</ns1:String>
</ WorkflowParameterBinding.Value>
</ WorkflowParameterBinding>
</ ns0:myActivity.ParameterBindings>
</ ns0:myActivity >
My parameterbindings property is coded like this:
public static DependencyProperty ParameterBindingsProperty =
System.Workflow.ComponentModel. DependencyProperty.Register(
"ParameterBindings", typeof(WorkflowParameterBindingCollection), typeof(BamPointActivity),
new PropertyMetadata(DependencyPropertyOptions.Metadata,
new Attribute[]{new BrowsableAttribute(false),
new DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Content)}));
[ Browsable(false)]
[ DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public WorkflowParameterBindingCollection ParameterBindings
{
//We only use this property to get the dynamic property values:
get
{
return ((WorkflowParameterBindingCollection)(base.GetValue(BamPointActivity.ParameterBindingsProperty)));
}
//TODO: Needed to remove the setter because of serialization bug : (callers now use setvalue directly)
//set
//{
// base.SetValue(BamPointActivity.ParameterBindingsProperty, value);
//}
}
Thanks for any assistance! Best regards! Christof
|