I want to create an activity with several child activities. I do not want the child activities to be modified and I do not want other activities added.
I could start with System.Workflow.Activities.Sequence and set each of the child items Visible property to False. But when my activity is placed in the workflow, someone can still drop additional activities onto my own because it derives from Sequence. I want this activity to appear as a logical whole and don't want items added to it.
If I start with System.Workflow.ComponentModel.CompositeActivity, it appears I will have to create a custom ToolboxItem that manually adds each of my child components and wires them up.
Is there not a better approach then either of these two
Regards,
Jared

'Sealed' Sequence or Designable CompositeActivity
VOEagain
AuzzieFlyBoy
ds12will
Jared,
I am pasting a sample code that shows you how to prevent dropping activities into your custom activity.
[
DesignerAttribute(typeof(MyDesigner))][ToolboxItemAttribute(typeof(ActivityToolboxItem))]
public partial class Activity1 : Sequence
{
public Activity1()
{
InitializeComponent();
}
} public class MyDesigner : SequenceDesigner
{
public override bool CanInsertActivities(HitTestInfo insertLocation, System.Collections.ObjectModel.ReadOnlyCollection<Activity> activitiesToInsert)
{
return false;
}
}
Hope this helps.
SunilKannan
You can write your own custom validator.
In SDK samples under custom activities there is a sample that helps you write a custom validator. You can tweak it to match your needs.
Hope it helps.
Chethan
Doc Glazer
[
Designer(typeof(ActivityDesigner))]public partial class Activity2: Sequence
{
...
Note that the Activity designer will still show the Sequence Designer, but when you drop the activity into a workflow, the associated designer will be displayed.
Hope this helps,
Arjun
Tyler Frugia
Please note that the custom designer approach achieves your goal in the UI, but does not ensure the integrity of your activity at the API level -- someone could still programmatically add activities. To prevent this, you will need to write a custom validator (in addition to doing the IsEditable/IsVisible changes you described).
Thanks for outlining your scenario, we'll consider if we can support it better.
King Gamo
I'm curious about the suggestion of a custom validator as well. Would this just keep the user from adding another item Or complain if they did
The designer is good. I will probably just plain old ActivityDesigner beause I want it to appear as a single contained step.
Thanks,
Jared