New instance of ViewModel each time view is activated

Oct 2, 2014 at 7:39 PM

First of all thank you for a great design !

I need a little assistance with implementing MVVM in it...

I am loading viewModels from DI container using contentLoader and it works fine.
My problem is that I would like to force ModernUI to ask contentLoader each time view is activated so that for some viewModels it will be new instance and for some it will the same (as specified in container).

Basically some forms should be loaded each time new instance so that i dont need to clear values and for some other views viewModels need to be the same to save values.

Thx in advance for your help.
Oct 2, 2014 at 9:11 PM
You can decorate your view with the ModernFrame.KeepAlive attached property so you control whether the view should be created each time it's activated or not.
Marked as answer by kozw on 10/3/2014 at 12:23 PM
Oct 3, 2014 at 8:30 AM
Thank you! It works like a charm !