Custom State Activity with Custom Designer

I have a custom activity which inherits from StateActivity. I implement my own FreeFormActivityDesigner and override the OnPaint event. When using a the state workflow designer either in VS or the re-hosting example the OnPaint event gets called and the shape is correctly painted while dragging the shape to the designer surface. However after dropping the shape it is not rendered even though the properties show up in the property sheet. I have looked at the FlowChart custom designer code but I must be missing something. If I drag and drop the shape in a sequential workflow it renders just fine.

Any help would be greatly appreciated.

smc750

[669 byte] By [smc750] at [2007-12-22]
# 1

After much experimentation I overrode the IsVisible property in the custom designer setting it to true. Why I had to do this is beyond me. The ActivityDesigner which is inherited by the FreeFormActivityDesigner sets the IsVisible property to true by default. So now the custom activity will now render in the state workflow designer.

smc750

smc750 at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 2
So, if I create a custom StateActivity (MyCustomStateActivity) and set designer to [Designer(typeof(ActivityDesigner), typeof(IDesigner))], when I drag and drop MyCustomStateActivity to StateMachineWorkflow does it will display?
RafaelLeonhardt at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 3

Yes it will display if you override the IsVisible property in the custom designer and setting it to true.

smc750

smc750 at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 4
Ok. But I think that, if the StateDesigner class was public, the work will be more simple.
Why does StateDesigner class is not public?
RafaelLeonhardt at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 5

Yes, that is the big mystery. All of the support classes for state activities are not public. It is strange that MSFT would enable you to extend the state activity, yet if you want to extend its behavior in the designer you must write it all. The FreeFormActivityDesigner lacks much of the functionality that the StateDesigner has. For example the ability to auto-connect state activities after setting the TargetState property of a contained SetStateActivity.

smc750

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

Software Development for Windows Vista

Site Classified