Reputation: 13
I'm working on an application and everything works fine but when I go back to the previous page the View Model is called so it will not maintain the old data.
I use this line to call My View Model in XAML.
prismmvvm:ViewModelLocator.AutoWireViewModel="true"
So my question is:
How do I disable the call of the View Model when I go back?
Upvotes: 1
Views: 376
Reputation: 831
You're referring caching here.
In the constructor of your ViewModel , set your NavigationCacheMode
this.NavigationCacheMode = NavigationCacheMode.Required;
and in OnNavigatedTo event handler , check your navigationMode and delete if you're doing something more than default initializing.
Upvotes: 1