I'm using WPF4 and PRISM4 for my new project.
There is a single module with several views in it. The DI is done with unity. When I navigate from ViewA to ViewB for the first time, the ViewB is created and its constructor is called. But when I try to navigate to ViewB for the second, third time, the ViewB is not created, but existing instance is reused.
I'm using IRegionManager.RequestNavigate for my navigation purposes.
I've tried to pass TransientLifeTimeManager to RegisterType Unity methods, but to no avail.
Is there a way to configure prism and/or unity to create a new view every time I navigate to it?
Thanks.
The way to do it is to implement IRegionMemberLifetime on your either your view or viewModel, and return false in the boolean property KeepAlive as follows:
public class EmployeeDetailsViewModel : IRegionMemberLifetime
{
public bool KeepAlive
{
get { return false; }
}
}