This documentation is archived and is not being maintained.

SetStateEventArgs Class

Represents a class that is used as an argument to set the state of a StateMachineWorkflowActivity.

Namespace: System.Workflow.Activities
Assembly: System.Workflow.Activities (in system.workflow.activities.dll)

public class SetStateEventArgs : EventArgs
/** @attribute SerializableAttribute() */ 
/** @attribute ComVisibleAttribute(false) */ 
public class SetStateEventArgs extends EventArgs
public class SetStateEventArgs extends EventArgs
Not applicable.

The StateMachineWorkflowActivity allows for setting the state from the host application. This enables the host application to override the current state of a state machine. This can be accomplished by enqueuing an instance of the SetStateEventArgs class to the WorkflowQueue named by the constant StateMachineWorkflowActivity.SetStateQueueName.

A simpler way to accomplish this is to use the SetState method in the StateMachineWorkflowInstance class.

You can use the SetState method to perform a SetState operation from the host, or you can do it yourself by enqueuing an event to the state machine workflow as shown in the following example.

public void SetState(string targetStateName)
      if (targetStateName == null)
            throw new ArgumentNullException("targetStateName");
      SetStateEventArgs args1 = new SetStateEventArgs(targetStateName);
      this.WorkflowInstance.EnqueueItemOnIdle("SetStateQueue", args1, null, null);

The state machine workflow uses a special queue called SetStateQueue to listen to these special events.


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 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0