Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
WorkflowDesignerMessageFilter Class
Collapse the table of content
Expand the table of content

WorkflowDesignerMessageFilter Class

Note: This API is now obsolete.

Provides a base class for all workflow message filters.

System.Object
  System.Workflow.ComponentModel.Design.WorkflowDesignerMessageFilter

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

[ObsoleteAttribute("The System.Workflow.* types are deprecated.  Instead, please use the new types from System.Activities.*")]
public abstract class WorkflowDesignerMessageFilter : IDisposable

The WorkflowDesignerMessageFilter type exposes the following members.

  NameDescription
Protected methodWorkflowDesignerMessageFilterWhen implemented in a derived class, initializes an instance of a WorkflowDesignerMessageFilter.
Top

  NameDescription
Protected propertyMessageHitTestContextGets the HitTestInfo that describes the context of the WorkflowDesignerMessageFilter.
Protected propertyParentViewGets the WorkflowView that is associated with the WorkflowDesignerMessageFilter.
Top

  NameDescription
Public methodDispose()Releases the resources used by the WorkflowDesignerMessageFilter.
Protected methodDispose(Boolean)Releases the unmanaged resources used by the WorkflowDesignerMessageFilter and optionally releases the managed resources.
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodFinalizeAttempts to free resources by calling Dispose(false) before the object is reclaimed by garbage collection. (Overrides Object.Finalize().)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodInitializeInitializes the WorkflowDesignerMessageFilter with the associated WorkflowView.
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Protected methodOnDragDropOccurs when the mouse button is released above an object during a drag operation.
Protected methodOnDragEnterOccurs when the mouse pointer enters the bounds of an object during a drag operation.
Protected methodOnDragLeaveOccurs when the mouse pointer leaves the bounds of an object during a drag operation.
Protected methodOnDragOverOccurs when the mouse pointer moves within the bounds of an object during a drag operation.
Protected methodOnGiveFeedbackOccurs during a drag operation.
Protected methodOnKeyDownOccurs when a key is pressed.
Protected methodOnKeyUpOccurs when a key is released.
Protected methodOnLayoutOccurs when child objects should be repositioned.
Protected methodOnMouseCaptureChangedOccurs when the items selected by dragging the mouse changes.
Protected methodOnMouseDoubleClickOccurs when you double-click the mouse.
Protected methodOnMouseDownOccurs when a mouse button is clicked.
Protected methodOnMouseEnterOccurs when the mouse pointer enters the bounds of an object.
Protected methodOnMouseHoverOccurs when the mouse pointer pauses above an object.
Protected methodOnMouseLeaveOccurs when the mouse pointer leaves the bounds of an object.
Protected methodOnMouseMoveOccurs when the mouse pointer moves while within the bounds of an object.
Protected methodOnMouseUpOccurs when the mouse button is released.
Protected methodOnMouseWheelOccurs when the mouse wheel moves.
Protected methodOnPaintOccurs when a paint message is received.
Protected methodOnPaintWorkflowAdornmentsOccurs when the workflow should repaint its adornments.
Protected methodOnQueryContinueDragOccurs during a drag operation.
Protected methodOnScrollOccurs when a user scrolls in a workflow designer.
Protected methodOnShowContextMenuOccurs when the workflow should show a context menu.
Protected methodOnThemeChangeOccurs when the theme of the workflow changes.
Protected methodProcessMessageOccurs when a raw Win32 message must be processed.
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

NoteNote

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

The workflow designer provides a Strategy design pattern to create replaceable message filter objects to handle events.

Derive from the WorkflowDesignerMessageFilter class to create message filters that can respond to workflow designer events, such as drag operations, layout and paint operations, and other designer events. To add a custom message filter to the message filters chain, call the AddDesignerMessageFilter on the WorkflowView or override the MessageFilters virtual property on the custom root activity and add the custom message filter to the collection returned from the base class.

The following code example shows a custom designer message filter that derives from WorkflowDesignerMessageFilter. The class, named CustomMessageFilter, overrides a number of its base class methods including OnMouseDown, OnMouseMove, OnMouseUp, OnMouseDoubleClick, OnMouseEnter, OnMouseHover, OnMouseLeave, OnDragEnter, OnDragOver, and OnKeyDown.

This code example is part of the Basic Designer Hosting SDK Sample from the DesignerShell.cs file. For more information, see Basic Designer Hosting.

internal sealed class CustomMessageFilter : WorkflowDesignerMessageFilter
{
    #region Members and Constructor

    private bool mouseDown;
    private IServiceProvider serviceProvider;
    private WorkflowView workflowView;
    private WorkflowDesignerLoader loader;

    public CustomMessageFilter(IServiceProvider provider, WorkflowView workflowView, WorkflowDesignerLoader loader)
    {
        this.serviceProvider = provider;
        this.workflowView = workflowView;
        this.loader = loader;
    }

    #endregion

    #region MessageFilter Overridables

    protected override bool OnMouseDown(MouseEventArgs eventArgs)
    {
        //Allow other components to process this event by not returning true. 
        this.mouseDown = true;
        return false;
    }

    protected override bool OnMouseMove(MouseEventArgs eventArgs)
    {
        //Allow other components to process this event by not returning true. 
        if (mouseDown)
        {
            workflowView.ScrollPosition = new Point(eventArgs.X, eventArgs.Y);
        }
        return false;
    }

    protected override bool OnMouseUp(MouseEventArgs eventArgs)
    {
        //Allow other components to process this event by not returning true.
        mouseDown = false;
        return false;
    }

    protected override bool OnMouseDoubleClick(MouseEventArgs eventArgs)
    {
        mouseDown = false;
        return true;
    }

    protected override bool OnMouseEnter(MouseEventArgs eventArgs)
    {
        //Allow other components to process this event by not returning true.
        mouseDown = false;
        return false;
    }

    protected override bool OnMouseHover(MouseEventArgs eventArgs)
    {
        //Allow other components to process this event by not returning true.
        mouseDown = false;
        return false;
    }

    protected override bool OnMouseLeave()
    {
        //Allow other components to process this event by not returning true.
        mouseDown = false;
        return false;
    }

    protected override bool OnMouseWheel(MouseEventArgs eventArgs)
    {
        mouseDown = false;
        return true;
    }

    protected override bool OnMouseCaptureChanged()
    {
        //Allow other components to process this event by not returning true.
        mouseDown = false;
        return false;
    }

    protected override bool OnDragEnter(DragEventArgs eventArgs)
    {
        return true;
    }

    protected override bool OnDragOver(DragEventArgs eventArgs)
    {
        return true;
    }

    protected override bool OnDragLeave()
    {
        return true;
    }

    protected override bool OnDragDrop(DragEventArgs eventArgs)
    {
        return true;
    }

    protected override bool OnGiveFeedback(GiveFeedbackEventArgs gfbevent)
    {
        return true;
    }

    protected override bool OnQueryContinueDrag(QueryContinueDragEventArgs qcdevent)
    {
        return true;
    }

    protected override bool OnKeyDown(KeyEventArgs eventArgs)
    {
        if (eventArgs.KeyCode == Keys.Delete)
        {
            ISelectionService selectionService = (ISelectionService)serviceProvider.GetService(typeof(ISelectionService));
            if (selectionService != null && selectionService.PrimarySelection is CodeActivity)
            {
                CodeActivity codeActivityComponent = (CodeActivity)selectionService.PrimarySelection;
                CompositeActivity parentActivity = codeActivityComponent.Parent;
                if (parentActivity != null)
                {
                    parentActivity.Activities.Remove(codeActivityComponent);
                    this.ParentView.Update();
                }
                loader.RemoveActivityFromDesigner(codeActivityComponent);

            }
        }
        return true;
    }

    protected override bool OnKeyUp(KeyEventArgs eventArgs)
    {
        return true;
    }

    protected override bool OnShowContextMenu(Point menuPoint)
    {
        return true;
    }

    #endregion
}

.NET Framework

Supported in: 4, 3.5, 3.0
Obsolete (compiler warning) in 4.6
Obsolete (compiler warning) in 4.6
Obsolete (compiler warning) in 4.5
Obsolete (compiler warning) in 4.5.1
Obsolete (compiler warning) in 4.5.2

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