This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies.
In a multiview user interface, you frequently have to update one view as a result of a user action on a different view. For example, one view displays a list of items, and the other view displays a description of an individual item. When an item is selected in the view with the list (action in one view), the view with the description displays the details for the item (reaction in the second view).
The solution is to make the presenters associated with the two views communicate through events. The logical view of the solution is shown in Figure 1. In this figure, View A detects that the user clicks an item. View B (which can be in a different module and/or work item) must react to the user event. To accomplish this, the following steps occur:
- View A calls its presenter, Presenter A.
- Presenter A raises an event with the event broker.
- The event broker notifies Presenter B of the event (Presenter B must subscribe to the event). Presenter B collects data from the model and instructs View B to display the information.
Communication between views
For the pattern to work in the client, which is based on the Composite UI Application Block, Presenter B has to be in the scope of the event raised by the Presenter A. This means that at least one of the following conditions must be true:
- The event topic has to be registered as global.
- The two views must be in the same WorkItem.
- The WorkItem that contains View A must be the parent of the WorkItem that contains View B.