Quantcast
Channel: patterns & practices: Prism
Viewing all articles
Browse latest Browse all 1878

New Post: Communicating between views in multitab application

$
0
0
We have application that uses the Prism library. The application has the WorkSpace region represented with the tab control which allows opening several instances of the same view at the same time (like mdi application).

What is a way to implement the following scenario:
  1. We have SearchView which contains FilterView and ResultView child views.
  2. We have several instances of the SearchView which opened in different tabs.
  3. Since we use the view-first approach the view model will be created in background for each of views. But view models will have no relations among themselves in this case, (it seems to be my main problem).
For example if two SearchView opened, in background we have the following view model objects created:

searchViewModel1, filterViewModel1, resultViewModel1
and
searchViewModel2, filterViewModel2, resultViewModel2.

When user clicks the “Apply Filter” button in the first tab, the filterViewModel1 should notify the resultViewModel1 to reload data.

But I am not sure, how we can notify the resultViewModel1 only, but not the resultViewModel2?

If I will use the event aggregator, the both resultViewModel1 and resultViewModel2 will be subscribed to refresh event....

Image

Viewing all articles
Browse latest Browse all 1878

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>