Can Activities defined in XOML file share data?
Hi,
I have seen an example "DesignerHostingApplication" where we define Prompt and Message activities and create XOML files and run them.
My Question is
How do we get the activities in the XOML to share data?I want the answer for the Prompt Activities to be shared by Message Activity so that I can display the Answer as a part of Message.
Please help
[402 byte] By [
keshavbs] at [2007-12-24]
Activity binding :
<?xml version="1.0" encoding="utf-8"?>
<SequentialWorkflowActivity x:Name="CustomWorkflow" xmlns:ns0="clr-namespace:ActivityLibrary;Assembly=ActivityLibrary, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/workflow" x:Class="WorkflowDesignerControl.CustomWorkflow">
<ns0:PromptActivity x:Name="promptActivity1" Answer="{x:Null}" Question="first name ?" />
<ns0:MessageActivity Message="{ActivityBind promptActivity1,Path=Answer}" x:Name="messageActivity1" />
</SequentialWorkflowActivity>
Hope this helps
Serge
HI Serge,
I am getting an error while compiling the xoml file.Its type mismatch "type ActivityBind cannot be converted to string type".
What changes need to be done in the activity definition to create the xoml file as shown above?
Yes.When I create the xoml from the xml you have posted, It does not compile and throws the error
I am using RC 3.0
the error in detail is
Error:347:Couldnot deserialise member'Message'Could not set value '{ActivityBind PromptActivity1,path=Answer}' on Member 'Message' of type'ActivityLibrary.MessageActivity'.Objectof type 'System.workflow.ComponentModel.ActivityBind' cannot convert to type'System.String'.
This error would be reported if Message property is not defined as dependency property. Non-dependency propertied cannot be bound using ActivityBind. More info at http://msdn2.microsoft.com/en-us/library/ms734789.aspx
public static DependencyProperty MessageProperty = System.Workflow.ComponentModel.DependencyProperty.Register("Message", typeof(string), typeof(MessageActivity));
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public MessageActivity Message
{
get
{
return ((MessageActivity)(base.GetValue(Workflow1.MessageProperty)));
}
set
{
base.SetValue(Workflow1.MessageProperty, value);
}
}