views:

188

answers:

1

Hi,

We are using mvvm light framework to build our application. In our ViewModel folder, we have number of Viewmodel like orderSupplyViewModel,HouseholdSupplyViewModel etc files as per the different functionality of the application. We have included all these viewModels in the MainViewModel by making the MainViewModel as partial class. So you can say we have one MainViewModel. Now we have completed 40% of the application and we need to separate the view Models as one partial class. So that we can call the different viewmodels from the mainviewModel. How to go about it? Following is the code realted to one viewmodel named - OrderSuppliesViewModel

namespace ParentalHealthClient.ViewModel { /// /// This class contains properties that a View can data bind to. /// /// public partial class MainViewModel : ViewModelBase { private List _selectedFavouriteMedicalItems; private List _selectedFavouriteHouseHoldItems; private List _selectedOrderItems; private HouseholdSuppliesDAO _dataAccessForOrder;

    /// <summary>
    /// Initializes a new instance of the OrderSuppliesViewModel class.
    /// </summary>
    public void OrderSuppliesViewModel()
    {


    }

Kindly suggest?

Thanks.

A: 

To communicate in a decoupled way MVVM Light toolkit provides the messenger Class. It can also launch dialogs and provide callbacks. Very handy very light very useful.

The Messenger is discribed here: http://www.galasoft.ch/mvvm/getstarted/

server info
Thanks. But we need to separate the different viewmodels as they all are one viewmodel i.e MainViewModel using the partial classes.Kindly Suggest?
Tarun
Don't understand it excatly. Why not use the or a ViewModelBase class and inherit common behavoir. Then you don't need partial classes? Or do you mean something different...
server info