Pick Activity Designer

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

The Pick activity provides event-based control flow. The activity executes one of several branches in response to a triggering event.

The Pick Activity

A Pick activity contains a collection of PickBranch objects, one of which the Pick activity can execute due to some incoming event that serves as a trigger. In this way Workflow Designer provides event-based control flow modeling. Each PickBranch contains a Trigger and an Action. At the beginning of a Pick activity's execution, all the trigger activities of the PickBranch elements are scheduled. When the first activity completes, the corresponding action activity is scheduled, and all other trigger activities are canceled.

How to use the Pick Activity Designer

Access the Pick activity designer in the Control Flow category of the Toolbox. The Pick activity designer can be dragged from the Toolbox and dropped on to the Workflow Designer surface wherever activity designers are normally placed, for example inside of a Sequence activity designer. After dropping it into Workflow Designer, it creates a Pick activity, which by default contains two empty PickBranch activities as elements with display names of Branch1 and Branch2. These respective DisplayName property values can be edited in the PickBranch activity designer header or within the Properties window for each branch.

There are two ways to add PickBranch activities to the collection of a Pick object: dragging and dropping the PickBranch designer from the Toolbox or by using the right-click menu from within the Pick design surface. For details, see the PickBranch topic. Notice that the only item that can be placed inside a Pick activity designer is a PickBranch activity designer.

Pick Activity Properties in the Workflow Designer

The following table shows the Pick properties and describes how they are used in the designer. These properties can be edited in property grid or on the designer surface.

Property Name Required Usage
DisplayName False Specifies the friendly name of the Pick activity designer in the header. The default value is Pick. The value can be edited in the property grid or directly on the header of the activity designer.

Although the DisplayName is not strictly required, it is a best practice to use one.

See also