A DTC can subscribe to Choice objects by notifying the engine about the type of choice objects to evaluate and bind to. More than one DTC can subscribe to any one choice.
This help topic covers the following subjects:
Static choices remain associated with the publisher throughout the publisher's lifetime.
Your subscribing DTC needs a handler to specify changes to user interface elements and code elements that use the choice information.
Note Only one Choice object is allowed for each ChoiceSink. If multiple choices match, only the first is bound. To find the set of available choices, your DTC can examine the Choices collection passed to the OnRebind method or call IDesignTimeControlSite::Available Choices. To improve performance, be sure to filter the Choices during the OnRebind method.
Dynamic choices are temporary and exist only as long as a subscriber is bound to them.
To subscribe to a dynamic choice, call the AvailableChoices property on the site to get the current collection of all available choices of all types. To collect these dynamic Choices, rebinds are necessary. For best performance, apply a ChoiceFilter to the engine's collection.
Note This AvailableChoices property is not available during certain methods, such as the OnRebind method.
Whenever the state of a Bound Choice is changed, the ChoicesEngine notifies the owner of the ChoiceSink that a change has occurred by calling the OnChoiceChange method. This notification applies to changes of all the properties of the Choice interface as well as changes to any of the tags associated with the Choice.
If for some reason your DTC no longer needs to subscribe to a particular choice, you can call the DeleteChoiceSink method on the sinks collection to delete a sink.
Note You only need to call this method directly when your DTC still exists but you do not want the sink to exist. The engine automatically calls DeleteChoiceSink when it detects that a DTC has been deleted.