This documentation is archived and is not being maintained.

ActivityToolboxItem Class

Provides a base class for all toolbox items associated with an activity in a workflow designer.

Namespace:  System.Workflow.ComponentModel.Design
Assembly:  System.Workflow.ComponentModel (in System.Workflow.ComponentModel.dll)

[SerializableAttribute]
[PermissionSetAttribute(SecurityAction.InheritanceDemand, Name = "FullTrust")]
[PermissionSetAttribute(SecurityAction.LinkDemand, Name = "FullTrust")]
public class ActivityToolboxItem : ToolboxItem

All toolbox items associated with an Activity class are derived from ActivityToolboxItem. This class displays a graphical representation of an Activity class in the toolbox of a design-time environment and creates an instance of the Activity class it is associated with when a user drags it onto the design surface. The activity toolbox item typically represents an activity to create when invoked on a design-mode document.

This class inherits directly from the ToolboxItem class.

The following example shows a complete ActivityToolboxItem class for a custom activity. In this example, the CreateComponentsCore method is overridden in order to place 2 custom activities within a ParallelActivity.

[Serializable]
internal sealed class CustomActivityToolboxItem : ActivityToolboxItem
{
    public CustomActivityToolboxItem(Type type)
        : base(type)
    {
    }

    private CustomActivityToolboxItem(SerializationInfo info, StreamingContext context)
    {
        Deserialize(info, context);
    }

    protected override IComponent[] CreateComponentsCore(IDesignerHost designerHost)
    {
        CompositeActivity parallel = new ParallelActivity();
        parallel.Activities.Add(new CustomActivity());
        parallel.Activities.Add(new CustomActivity());

        return new IComponent[] { parallel };
    }
}

System.Object
  System.Drawing.Design.ToolboxItem
    System.Workflow.ComponentModel.Design.ActivityToolboxItem

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0
Show: