Why do we need IMainPageViewModel?

Nov 7, 2014 at 10:16 PM
I don't get it what the purpose of like IViewModel is.
IMainPageViewModel
ILoginPageViewModel.

Why do we need?
Coordinator
Jan 6, 2015 at 9:23 PM
Since the viewmodel may be out of scope of the current page at designtime, creating an interface lets you create an identical, though limited, designtime version of the viewmodel which you can use at designtime and get intellisense in your XAML binding. AutoWireUp does not enable intellisense. Our recommendation is for a separate designtime and runtime viewmodel, this gives you a clear separation. The interface unites them and ensures their signatures. The only other real option is to have a single viewmodel with some designtime logic to fork the logic (in the constructor) when you are in designtime and fake the data load. It works. I've done it. But it's not as clean and is far more error-prone than a dedicated designtime viewmodel. If you have two classes that should have the same signature, you should use an interface or a base class to ensure it stays in sync. // Jerry