แก้ไข

แชร์ผ่าน


ActivityToolboxItem Class

Definition

Caution

The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*

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

public ref class ActivityToolboxItem : System::Drawing::Design::ToolboxItem
[System.Serializable]
public class ActivityToolboxItem : System.Drawing.Design.ToolboxItem
[System.Serializable]
[System.Obsolete("The System.Workflow.* types are deprecated.  Instead, please use the new types from System.Activities.*")]
public class ActivityToolboxItem : System.Drawing.Design.ToolboxItem
[<System.Serializable>]
type ActivityToolboxItem = class
    inherit ToolboxItem
[<System.Serializable>]
[<System.Obsolete("The System.Workflow.* types are deprecated.  Instead, please use the new types from System.Activities.*")>]
type ActivityToolboxItem = class
    inherit ToolboxItem
Public Class ActivityToolboxItem
Inherits ToolboxItem
Inheritance
ActivityToolboxItem
Attributes

Examples

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 };
    }
}
<Serializable()> _
Friend Class CustomActivityToolboxItem
    Inherits ActivityToolboxItem

    Public Sub New(ByVal type As Type)
        MyBase.new(type)
    End Sub

    Private Sub New(ByVal info As SerializationInfo, ByVal context As StreamingContext)
        Deserialize(info, context)
    End Sub

    Protected Overrides Function CreateComponentsCore(ByVal designerHost As IDesignerHost) As IComponent()
        Dim parallel As New ParallelActivity()
        parallel.Activities.Add(New CustomActivity())
        parallel.Activities.Add(New CustomActivity())

        Return New IComponent() {parallel}
    End Function
End Class

Remarks

Note

This material discusses types and namespaces that are obsolete. For more information, see Deprecated Types in Windows Workflow Foundation 4.5.

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.

Constructors

ActivityToolboxItem()

Initializes a new instance of the ActivityToolboxItem class.

ActivityToolboxItem(SerializationInfo, StreamingContext)

Initializes a new instance of the ActivityToolboxItem class by using the specified SerializationInfo and StreamingContext.

ActivityToolboxItem(Type)

Initializes a new instance of the ActivityToolboxItem class that creates the specified type of Activity component.

Properties

AssemblyName

Gets or sets the name of the assembly that contains the type or types that the toolbox item creates.

(Inherited from ToolboxItem)
Bitmap

Gets or sets a bitmap to represent the toolbox item in the toolbox.

(Inherited from ToolboxItem)
Company

Gets or sets the company name for this ToolboxItem.

(Inherited from ToolboxItem)
ComponentType

Gets the component type for this ToolboxItem.

(Inherited from ToolboxItem)
DependentAssemblies

Gets or sets the AssemblyName for the toolbox item.

(Inherited from ToolboxItem)
Description

Gets or sets the description for this ToolboxItem.

(Inherited from ToolboxItem)
DisplayName

Gets or sets the display name for the toolbox item.

(Inherited from ToolboxItem)
Filter

Gets or sets the filter that determines whether the toolbox item can be used on a destination component.

(Inherited from ToolboxItem)
IsTransient

Gets a value indicating whether the toolbox item is transient.

(Inherited from ToolboxItem)
Locked

Gets a value indicating whether the ToolboxItem is currently locked.

(Inherited from ToolboxItem)
OriginalBitmap

Gets or sets the original bitmap that will be used in the toolbox for this item.

(Inherited from ToolboxItem)
Properties

Gets a dictionary of properties.

(Inherited from ToolboxItem)
TypeName

Gets or sets the fully qualified name of the type of IComponent that the toolbox item creates when invoked.

(Inherited from ToolboxItem)
Version

Gets the version for this ToolboxItem.

(Inherited from ToolboxItem)

Methods

CheckUnlocked()

Throws an exception if the toolbox item is currently locked.

(Inherited from ToolboxItem)
CreateComponents()

Creates the components that the toolbox item is configured to create.

(Inherited from ToolboxItem)
CreateComponents(IDesignerHost, IDictionary)

Creates the components that the toolbox item is configured to create, using the specified designer host and default values.

(Inherited from ToolboxItem)
CreateComponents(IDesignerHost)

Creates the components that the toolbox item is configured to create, using the specified designer host.

(Inherited from ToolboxItem)
CreateComponentsCore(IDesignerHost, IDictionary)

Creates an array of components when the toolbox item is invoked.

(Inherited from ToolboxItem)
CreateComponentsCore(IDesignerHost)

Creates an Activity component or an array of Activity components when the toolbox item is invoked.

CreateComponentsWithUI(IDesignerHost)

Creates an Activity component or an array of Activity components that generate a dialog box on the design surface when the toolbox item is invoked.

Deserialize(SerializationInfo, StreamingContext)

Loads the state of the toolbox item from the specified serialization information object.

(Inherited from ToolboxItem)
Equals(Object)

Determines whether two ToolboxItem instances are equal.

(Inherited from ToolboxItem)
FilterPropertyValue(String, Object)

Filters a property value before returning it.

(Inherited from ToolboxItem)
GetHashCode()

Returns the hash code for this instance.

(Inherited from ToolboxItem)
GetToolboxDisplayName(Type)

Gets the associated display name for the Toolbox item in the Toolbox.

GetToolboxImage(Type)

Gets the associated Image that is used to represent the Toolbox item in the Toolbox.

GetType()

Gets the Type of the current instance.

(Inherited from Object)
GetType(IDesignerHost, AssemblyName, String, Boolean)

Creates an instance of the specified type, optionally using a specified designer host and assembly name.

(Inherited from ToolboxItem)
GetType(IDesignerHost)

Enables access to the type associated with the toolbox item.

(Inherited from ToolboxItem)
Initialize(Type)

Initializes the current toolbox item with the specified type to create.

(Inherited from ToolboxItem)
Lock()

Locks the toolbox item and prevents changes to its properties.

(Inherited from ToolboxItem)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
OnComponentsCreated(ToolboxComponentsCreatedEventArgs)

Raises the ComponentsCreated event.

(Inherited from ToolboxItem)
OnComponentsCreating(ToolboxComponentsCreatingEventArgs)

Raises the ComponentsCreating event.

(Inherited from ToolboxItem)
Serialize(SerializationInfo, StreamingContext)

Saves the state of the toolbox item to the specified serialization information object.

(Inherited from ToolboxItem)
ToString()

Returns a String that represents the current ToolboxItem.

(Inherited from ToolboxItem)
ValidatePropertyType(String, Object, Type, Boolean)

Validates that an object is of a given type.

(Inherited from ToolboxItem)
ValidatePropertyValue(String, Object)

Validates a property before it is assigned to the property dictionary.

(Inherited from ToolboxItem)

Events

ComponentsCreated

Occurs immediately after components are created.

(Inherited from ToolboxItem)
ComponentsCreating

Occurs when components are about to be created.

(Inherited from ToolboxItem)

Explicit Interface Implementations

ISerializable.GetObjectData(SerializationInfo, StreamingContext)

For a description of this member, see the GetObjectData(SerializationInfo, StreamingContext) method.

(Inherited from ToolboxItem)

Applies to