I am using Simple MVVM Toolkit in WPF to create an application, the application uses a central tab control, with a View (UserControl) for each tab item. These Views may also contain tab controls themselves containing further "sub-views".
Our difficulty is in finding a way to share application logic which is used by several of these views, without having one global huge messy class..
I would not go with a huge class which holds everything. But I would have a central ViewModel which controls the overall state. Like the ShellViewModel. And I would let the viewmodels communicate and exchange information via Messenger (MVVM Toolkit light) or EventAggregator (Prism). They offer way vie Publish/Subscriber Pattern to exchange information. And you can address them by implementing own message classes and pass payload along with it.
So you could have a global Message for Save all and every (Sub-)ViewModel could register to it and runs there own save method after receiving the message...
Prism http://msdn.microsoft.com/en-us/library/ff921122(v=pandp.20).aspx
MVVM light http://blog.galasoft.ch/archive/2009/09/27/mvvm-light-toolkit-messenger-v2-beta.aspx
Let me know if this helps...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With