Code Activity context menu questions

On the code activity context menu, two of the selections are:

Promote Bindable Properties

and

Bind Property 'ExecuteCode' (assuming that I placed a value into the Executecode property and created a handler).

I'd like to have a better understanding of what these menu selections do. For example, why would a code activity, from the toolbox, have a bindable property? Wouldn't that have to be a custom activity with a dependency property I created?

And why would I bind my ExecuteCode method to a property?

Thanks.

[559 byte] By [stombiztalker] at [2007-12-22]
# 1

Property promotion applies equally to the built-in activities as well as your own custom activities.

You are correct that DependencyProperty is the key to the designer knowing what properties to "promote". Thus because ExecuteCode is a dependencyproperty on CodeActivity - the designer gives you these options.

The concept of property promotion in general is that you may have a child activity that has a property which you may want to connected to properties on the parent. Property promotion creates a connection between a new property on the parent - and the property on the child.

JonFlanders at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 2

So then, in the case of the Code activity directly off of the toolbox, would there be any reason that you would want to promote the ExecuteCode property? For example, if I promoted the ExecuteCode property and this property is tied to a method called SetStatus, then from somewhere within the workflow itself could I call back into this SetStatus method?

That example probably doesn't make any sense, but I can see why you would want this on a custom activity, just not a canned one.

Thanks!

stombiztalker at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 3
Hi. I am trying get this to work but it won't.

First I have a workflow which runs the ExecuteCode activity. I promoted the bindable properties of the execute code - that worked fine. But when I wrapped the Workflow I created in an Invokeworkflow activity I had no access to the ExecuteCode activity.

Am I doing something wrong?

TomPepe at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 4
Just because you can promote a handler doesn't mean that it is appropriate for all situations or even allowed. Event handlers on a root activity can not be set outside of that root activity. As an example point to another workflow type instead of your custom activity. You won't see the Completed or Initialized handlers either.
TomLake-MSFT at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 5
You're right. That was not the best approach to what I was trying to accomplish. I took a new approach. It's more straightforward and it works. Thanks.
TomPepe at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...

Software Development for Windows Vista

Site Classified