Sharepoint Custom Activity for workflows : dependency property which is of type "Typed DataTable". Hi,<br><br>I m creating a sharepoint custom activity for workflows.<br>Can someone please tell me if it is feasible to create a dependency property which is of type &quot;Typed DataTable&quot;?<br><br><br>I have created a property as:<br><br><font size=2> </font><p><font style="font-size:10px"><font style="font-size:10px" color="#0000ff">public</font> <font style="font-size:10px" color="#0000ff">static</font> <font style="font-size:10px" color="#2b91af">DependencyProperty</font><font style="font-size:10px"> DtProperty = </font><font style="font-size:10px" color="#2b91af">DependencyProperty</font><font style="font-size:10px">.Register(</font><font style="font-size:10px" color="#a31515">&quot;DtProperty&quot;</font><font style="font-size:10px">, </font><font style="font-size:10px" color="#0000ff">typeof</font><font style="font-size:10px">(TypedDataTable.</font><font style="font-size:10px" color="#2b91af">DataTable</font><font style="font-size:10px">), </font><font style="font-size:10px" color="#0000ff">typeof</font><font style="font-size:10px">(Activity.</font><font style="font-size:10px" color="#2b91af">OperationActivity</font></font><font size=2><font style="font-size:10px">));</font></font></p><font size=2> </font><p><font size=2><font style="font-size:10px">[</font></font><font style="font-size:10px"><font style="font-size:10px" color="#2b91af">DesignerSerializationVisibilityAttribute</font><font style="font-size:10px">(</font><font style="font-size:10px" color="#2b91af">DesignerSerializationVisibility</font></font><font size=2><font style="font-size:10px">.Visible)]</font></font></p><font size=2> </font><p><font size=2><font style="font-size:10px">[</font></font><font style="font-size:10px"><font style="font-size:10px" color="#2b91af">BrowsableAttribute</font><font style="font-size:10px">(</font><font style="font-size:10px" color="#0000ff">true</font></font><font size=2><font style="font-size:10px">)]</font></font></p><font size=2> </font><p><font size=2><font style="font-size:10px">[</font></font><font style="font-size:10px"><font style="font-size:10px" color="#2b91af">CategoryAttribute</font><font style="font-size:10px">(</font><font style="font-size:10px" color="#a31515">&quot;Misc&quot;</font><font style="font-size:10px">)]</font></font><font size=2></font></p><font size=2> </font><p><font style="font-size:10px"><font style="font-size:10px" color="#0000ff">public</font> TypedDataTable.<font style="font-size:10px" color="#2b91af">DataTable</font></font><font size=2><font style="font-size:10px"> dt1<br>{</font></font></p><font size=2> </font><p><font color="#0000ff" size=2><font style="font-size:10px">get</font></font></p><font color="#0000ff" size=2></font><font size=2> <p><font style="font-size:10px">{</font></p> </font><p><font style="font-size:10px"><font style="font-size:10px" color="#0000ff">return</font><font style="font-size:10px"> ((TypedDataTable.<font style="font-size:10px" color="#2b91af">DataTable</font></font><font style="font-size:10px">)(</font><font style="font-size:10px" color="#0000ff">base</font><font style="font-size:10px">.GetValue(Activity.</font><font style="font-size:10px" color="#2b91af">OperationActivity</font></font><font size=2><font style="font-size:10px">.<font style="font-size:10px">DtProperty </font>)));</font></font></p><font size=2> <p><font style="font-size:10px">}</font></p> </font><p><font color="#0000ff" size=2><font style="font-size:10px">set</font></font></p><font color="#0000ff" size=2></font><font size=2> <p><font style="font-size:10px">{</font></p> </font><p><font style="font-size:10px"><font style="font-size:10px" color="#0000ff">base</font><font style="font-size:10px">.SetValue(Activity.</font><font style="font-size:10px" color="#2b91af">OperationActivity</font><font style="font-size:10px">.<font style="font-size:10px">DtProperty </font> </font><font style="font-size:10px" color="#0000ff">value</font></font><font size=2><font style="font-size:10px">);</font></font></p><font size=2> <p><font style="font-size:10px">}</font></p> <p><font style="font-size:10px">}<br><br><br>It gives me below error message:<br><font color="#cc6600">Could not create activity of type 'Activity.OperationActivity'. System.ArgumentException: Type 'Activity.OperationActivity' does not define a static dependency property with name 'DtPropertyProperty'.<br>Parameter name: ownerType<br>   at System.Workflow.ComponentModel.DependencyProperty.ValidateAndRegister(String name, Type propertyType, Type ownerType, PropertyMetadata defaultMetadata, Type validatorType, Boolean isRegistered)<br>   at System.Workflow.ComponentModel.DependencyProperty.Register(String name, Type propertyType, Type ownerType)<br>   at Activity.OperationActivity..cctor()<br><br><br></font><font style="font-size:12px" color="#000000">Any help on this??</font></font></p></font>© 2009 Microsoft Corporation. All rights reserved.Tue, 13 Jan 2009 08:56:19 Z16b2bf3d-9939-4a83-b923-85838eebbec9http://social.msdn.microsoft.com/Forums/en-US/sharepointworkflow/thread/16b2bf3d-9939-4a83-b923-85838eebbec9#16b2bf3d-9939-4a83-b923-85838eebbec9http://social.msdn.microsoft.com/Forums/en-US/sharepointworkflow/thread/16b2bf3d-9939-4a83-b923-85838eebbec9#16b2bf3d-9939-4a83-b923-85838eebbec9MonicaThttp://social.msdn.microsoft.com/Profile/en-US/?user=MonicaTSharepoint Custom Activity for workflows : dependency property which is of type "Typed DataTable". Hi,<br><br>I m creating a sharepoint custom activity for workflows.<br>Can someone please tell me if it is feasible to create a dependency property which is of type &quot;Typed DataTable&quot;?<br><br><br>I have created a property as:<br><br><font size=2> </font><p><font style="font-size:10px"><font style="font-size:10px" color="#0000ff">public</font> <font style="font-size:10px" color="#0000ff">static</font> <font style="font-size:10px" color="#2b91af">DependencyProperty</font><font style="font-size:10px"> DtProperty = </font><font style="font-size:10px" color="#2b91af">DependencyProperty</font><font style="font-size:10px">.Register(</font><font style="font-size:10px" color="#a31515">&quot;DtProperty&quot;</font><font style="font-size:10px">, </font><font style="font-size:10px" color="#0000ff">typeof</font><font style="font-size:10px">(TypedDataTable.</font><font style="font-size:10px" color="#2b91af">DataTable</font><font style="font-size:10px">), </font><font style="font-size:10px" color="#0000ff">typeof</font><font style="font-size:10px">(Activity.</font><font style="font-size:10px" color="#2b91af">OperationActivity</font></font><font size=2><font style="font-size:10px">));</font></font></p><font size=2> </font><p><font size=2><font style="font-size:10px">[</font></font><font style="font-size:10px"><font style="font-size:10px" color="#2b91af">DesignerSerializationVisibilityAttribute</font><font style="font-size:10px">(</font><font style="font-size:10px" color="#2b91af">DesignerSerializationVisibility</font></font><font size=2><font style="font-size:10px">.Visible)]</font></font></p><font size=2> </font><p><font size=2><font style="font-size:10px">[</font></font><font style="font-size:10px"><font style="font-size:10px" color="#2b91af">BrowsableAttribute</font><font style="font-size:10px">(</font><font style="font-size:10px" color="#0000ff">true</font></font><font size=2><font style="font-size:10px">)]</font></font></p><font size=2> </font><p><font size=2><font style="font-size:10px">[</font></font><font style="font-size:10px"><font style="font-size:10px" color="#2b91af">CategoryAttribute</font><font style="font-size:10px">(</font><font style="font-size:10px" color="#a31515">&quot;Misc&quot;</font><font style="font-size:10px">)]</font></font><font size=2></font></p><font size=2> </font><p><font style="font-size:10px"><font style="font-size:10px" color="#0000ff">public</font> TypedDataTable.<font style="font-size:10px" color="#2b91af">DataTable</font></font><font size=2><font style="font-size:10px"> dt1<br>{</font></font></p><font size=2> </font><p><font color="#0000ff" size=2><font style="font-size:10px">get</font></font></p><font color="#0000ff" size=2></font><font size=2> <p><font style="font-size:10px">{</font></p> </font><p><font style="font-size:10px"><font style="font-size:10px" color="#0000ff">return</font><font style="font-size:10px"> ((TypedDataTable.<font style="font-size:10px" color="#2b91af">DataTable</font></font><font style="font-size:10px">)(</font><font style="font-size:10px" color="#0000ff">base</font><font style="font-size:10px">.GetValue(Activity.</font><font style="font-size:10px" color="#2b91af">OperationActivity</font></font><font size=2><font style="font-size:10px">.<font style="font-size:10px">DtProperty </font>)));</font></font></p><font size=2> <p><font style="font-size:10px">}</font></p> </font><p><font color="#0000ff" size=2><font style="font-size:10px">set</font></font></p><font color="#0000ff" size=2></font><font size=2> <p><font style="font-size:10px">{</font></p> </font><p><font style="font-size:10px"><font style="font-size:10px" color="#0000ff">base</font><font style="font-size:10px">.SetValue(Activity.</font><font style="font-size:10px" color="#2b91af">OperationActivity</font><font style="font-size:10px">.<font style="font-size:10px">DtProperty </font> </font><font style="font-size:10px" color="#0000ff">value</font></font><font size=2><font style="font-size:10px">);</font></font></p><font size=2> <p><font style="font-size:10px">}</font></p> <p><font style="font-size:10px">}<br><br><br>It gives me below error message:<br><font color="#cc6600">Could not create activity of type 'Activity.OperationActivity'. System.ArgumentException: Type 'Activity.OperationActivity' does not define a static dependency property with name 'DtPropertyProperty'.<br>Parameter name: ownerType<br>   at System.Workflow.ComponentModel.DependencyProperty.ValidateAndRegister(String name, Type propertyType, Type ownerType, PropertyMetadata defaultMetadata, Type validatorType, Boolean isRegistered)<br>   at System.Workflow.ComponentModel.DependencyProperty.Register(String name, Type propertyType, Type ownerType)<br>   at Activity.OperationActivity..cctor()<br><br><br></font><font style="font-size:12px" color="#000000">Any help on this??</font></font></p></font>Mon, 05 Jan 2009 10:57:50 Z2009-01-05T15:10:07Zhttp://social.msdn.microsoft.com/Forums/en-US/sharepointworkflow/thread/16b2bf3d-9939-4a83-b923-85838eebbec9#dff1d220-921a-4c3a-a160-8e29ebeeb371http://social.msdn.microsoft.com/Forums/en-US/sharepointworkflow/thread/16b2bf3d-9939-4a83-b923-85838eebbec9#dff1d220-921a-4c3a-a160-8e29ebeeb371Michael Washam - MSFThttp://social.msdn.microsoft.com/Profile/en-US/?user=Michael%20Washam%20-%20MSFTSharepoint Custom Activity for workflows : dependency property which is of type "Typed DataTable". Moving to the workflow forums<hr class="sig">Posting is provided &quot;AS IS&quot; with no warranties, and confers no rights.Mon, 05 Jan 2009 13:42:07 Z2009-01-05T13:42:07Zhttp://social.msdn.microsoft.com/Forums/en-US/sharepointworkflow/thread/16b2bf3d-9939-4a83-b923-85838eebbec9#f05f27fe-4f54-4710-b05e-3e20f4912da9http://social.msdn.microsoft.com/Forums/en-US/sharepointworkflow/thread/16b2bf3d-9939-4a83-b923-85838eebbec9#f05f27fe-4f54-4710-b05e-3e20f4912da9Windie Chai [MVP]http://social.msdn.microsoft.com/Profile/en-US/?user=Windie%20Chai%20%5bMVP%5dSharepoint Custom Activity for workflows : dependency property which is of type "Typed DataTable". Hi,<br><br>The correct code should be:<br> <p><font style="font-size:10px"><font style="font-size:10px" color="#0000ff">public</font> <font style="font-size:10px" color="#0000ff">static</font> <font style="font-size:10px" color="#2b91af">DependencyProperty</font><font style="font-size:10px"> DtProperty = </font><font style="font-size:10px" color="#2b91af">DependencyProperty</font><font style="font-size:10px">.Register(</font><font style="font-size:10px" color="#a31515">&quot;<strong><font style="font-size:16px">dt1</font></strong>&quot;</font><font style="font-size:10px">, </font><font style="font-size:10px" color="#0000ff">typeof</font><font style="font-size:10px">(TypedDataTable.</font><font style="font-size:10px" color="#2b91af">DataTable</font><font style="font-size:10px">), </font><font style="font-size:10px" color="#0000ff">typeof</font><font style="font-size:10px">(Activity.</font><font style="font-size:10px" color="#2b91af">OperationActivity</font></font><font size=2><font style="font-size:10px">));<br></font></font><font style="font-size:10px"><font style="font-size:10px" color="#0000ff">......<br>public</font> TypedDataTable.<font style="font-size:10px" color="#2b91af">DataTable</font></font><font size=2><font style="font-size:10px"> <font style="font-size:16px"><strong><font style="font-size:16px">dt1</font></strong><br></font>{<br></font></font><font size=2><font style="font-size:10px">......<br>}<br><br><font style="font-size:12px">the 1st parameter of Register method must be a correct valid property name, and the 2nd parameter is the type of that property.<br><br>And I must remind you, if you want to use this property in SharePoint workflow, please ensure <font style="font-size:12px">TypedDataTable.</font><font style="font-size:12px" color="#2b91af">DataTable<font style="font-size:12px" color="#000000"> <font style="font-size:12px">can be serialize.</font></font></font></font></font></p></font><hr class="sig">My blog: http://xiaoshatian.cnblogs.comWed, 07 Jan 2009 01:39:56 Z2009-01-07T01:39:56Z