I am using datatemplate to load my views using PRISM 4 discovery. I have a need to create the view/viewmodel multiple times rather than reuse existing instances so I set x:Shared=false in the resource but it only has impact on the viewmodel. I can confirm that the viewmodel is not reused but the view is. The view constructor is only called once the first time it is called. I have read similar posts here but their solutions did not work for me. I want to know if I can some how extend the resource loader/locator and make sure it respects the Shared flag.
Here is how my template is defined:
<DataTemplate DataType="{x:Type CVM:MyViewModel}" x:Shared="False">
<V:MyView />
</DataTemplate>
PartCreationPolicy
attribute.Shared
= singleton,NonShared
= a new instance. Have you decorated your view with[PartCreationPolicy(CreationPolicy.NonShared)]
? – Vespertilionine