[MSP]Daniel Oliveira

Hi,

I have the following scenario:

I have a custom activity named BaseActivity. This acivity has a DependencyProperty string name.
I have a custom activity named ComposityActivity. This activity is a sequential activity which has two child activities: BaseActivity and CodeActivity.

I create an instance of ComposityActivity and I set the property name to "Test", then I create an instance of SequentialWorkflowActivity and I add the instance of ComposityActivity.
When I use WorkflowMarkupSerialize to write a XOML representation of the instance I lost que value of my string because it write something like:

<SequenceActivity x:Name="SequenceActivity" etc...>
<ns0:ComposityActivity:Name="composityActivity1" />
</SequenceActivity>

How can I serialize and preserve the values of my child activities
I'm not running the workflow yet, just creating.

Thank you.
Daniel Oliveira




Re: Windows Workflow Foundation Markup with ComposityActivities

ElifOn - MSFT

Try having the dependency property as an attached property so that you can set it on the ComposityActivity and then you may be able to see the value in the xoml.

Hope this helps

Elif






Re: Windows Workflow Foundation Markup with ComposityActivities

dfoliveira

Hi,

I thanks for your sugestion, but it didn't work. I created an attached property but I can't see the value on the XOML.
If I serialize, I'll have the same problem.

Daniel.






Re: Windows Workflow Foundation Markup with ComposityActivities

Angel Azcarraga - MSFT

Is the property on ComposityActivity as well as on the child BaseActivity or is it only on the child BaseActivity

When you compile ComposityActivity, have you already set the property on the child BaseActivity or not

Thanks,
Angel






Re: Windows Workflow Foundation Markup with ComposityActivities

dfoliveira

Sorry, I didn't understand:
"Is the property on ComposityActivity as well as on the child BaseActivity or is it only on the child BaseActivity "

The ComposityActivity is a SequentialActivity and has one activity inside, that is BaseActivity.

Here is the XOML of the ComposityActivity:

<SequenceActivity x:Class="WorkflowLibrary1.ComposityActivity" ...>
<ns0:Base x:Name="base1" Comment="It's a comment." />
</SequenceActivity>

I tried to set the value on BaseActivity after and before compile, but what I want is after.

Thank you for your attention.






Re: Windows Workflow Foundation Markup with ComposityActivities

Angel Azcarraga - MSFT

Ok, I think I get it now. The property is on the child activity only.

Once you compile ComposityActivity, you will not have access to it's child activity. If you want to be able to control the property of the child after it's compiled, you will need to "promote" that property. You can do this by bringing up the Activity Bind dialog for your Comment property in the property browser (double-click the little blue button next to the property name). Select the tab above entitled "Bind to new member." Give your property a name and it will create a property of the same type on ComposityActivity, and the child's property will be bound to the property. Now when you compile the activity and drop it in a workflow, you set the Comment property on ComposityActivity (and you'll see this serialized), and when it executes and the internal child executes, it will pull this value through the binding.

-Angel






Re: Windows Workflow Foundation Markup with ComposityActivities

dfoliveira

Yes. It's done. It's working.
Thank you so much.
Do you have a blog

Daniel






Re: Windows Workflow Foundation Markup with ComposityActivities

Angel Azcarraga - MSFT

No blog at the time, but hopefully in the near future. : )

Glad it works.

Thanks,
Angel