Communication between views

Topics: Prism v4 - WPF 4
Dec 18, 2010 at 7:05 AM



 I have 2 views

 ViewA displays product categories: cars, books etc

 And ViewB display the products in a category

 When user click a category then ViewA_ViewModel display  ViewB.

 What's the Prism way to tell ViewB to load the category's items?

 Since any way the views are coupled  and are part of the same

 application,i don't think i should send a message?

 Thanks in advance

Dec 20, 2010 at 5:06 PM



Prism provides guidance to fulfill your requirement, by using View Based Navigation.


You can read more about in Chapter 8: Navigation.


In case you need to pass parameters during navigation (in your scenario this will be from ViewA to ViewB), you might find useful the UriQuery class to set the values you need to pass and NavigationContext class, to retrieve them back in your target view.


You can read about UriQuery and NavigationContext specifically here.


I hope you find this information useful.


Miguel Bronzovic


Jan 30, 2011 at 7:16 PM

Thanks,exactly what i was looking for.