View not getting rendered using DataTemplate - Resolved

Topics: Prism v4 - WPF 4
Jun 26, 2011 at 3:59 PM
Edited Jun 26, 2011 at 4:00 PM


Following the MVVM concept, I am trying to create a simple Prism application, wherein I resolve an OrderViewModel in my ShellViewModel and then add it to "MainRegion" of Shell View as shown below.


            IRegion mainRegion = regionManager.Regions["MainRegion"];
            OrderViewModel orderViewModel =
There is a DataTemplate defined in my Application resources which has DataType OrderViewModel as shown below.



        <DataTemplate DataType="{x:Type vm:OrderViewModel}">


My problem is that the OrderView as identified by DataTemplate is not picked up by Prism (or WPF). Instead the OrderViewModel's namespace qualified name is displayed in the window. Please help me solve this issue.



Jun 27, 2011 at 2:48 AM

Resolved. Need to merge resource dictionary of the assembly holding the DataTemplate with the main application resources like this


Although this approach is not ideal, it works. Will try to remove the dependency using a cleaner approach.