.
Hello guys,
Consider the usual scenario of Prism (WPF/Silverlight) in which we’ve multiple regions, and in each goes a view (XAML), so a situation might arise when we interact with one view (XAML), either using mouse, or keyboard, we may want to change or update other views (which happen to be different XAMLs) accordingly. For example, on selecting an item from a view, say ItemPanelView, we may want to show the details of the selected item in other view, say ItemDetailsView.
So my question is,
Would it be a good idea to bind elements from one view (XAML), to the elements in the other views (different XAMLs), to implement such functionalities? If I’m not wrong, using this approach we would not need to go from one presenter to other (using TwoWay bindings etc), so as to update the view in other region.
Or, is there any elegant yet simple way to do this?
.
I suggest you take a look at the Prism’s EventAggregator (http://blogs.msdn.com/b/francischeung/archive/2008/06/02/decoupled-communication-with-prism-event-aggregation.aspx). Each of your views (or preferably view models to which views can respond/update using triggers) can subscribe to / publish a shared event. However, I suggest that instead of simply responding to a mouse click or keyboard event to raise this shared event, make the shared event meaningful (i.e. MyItemSelected or MyItemHidden). If you need more assistance or clarification with this, let me know.