what the Better way to do master detail with MVVM (catel)

Sep 21, 2011 at 9:49 PM

hi Geert and others :)

I want to make a master - detail scenario with two datagrids or  UserControl 

What are your suggestion to this relationship issue? 

Please  if possible Explain with example


Sep 22, 2011 at 6:42 PM

Excellent question. Sorry it took some time to respond, but I decided to write an example application for this including documentation.

The example app is added to the Catel Examples repository, and is called Catel.Examples.WPF.MasterDetail.

The documentation can be found here:


Have fun, and if you have any questions, don't hesitate to contact us!

Sep 23, 2011 at 9:05 PM
Edited Sep 23, 2011 at 9:10 PM

tanx for reply

Your solution doesn't solve my problem ,Let me rephrase my question

how to Communicate between two user-controls Or (Two viewmodels )

i have 2 usercontrols , parent and child .

Parent is hosting the child , both have thier own viewmodels .

please see this blog :


I want to implement this scenario with two usercontorl (Customerview and OrdersView) 
Do you know a better and simple way for implement  this scenario?
maybe I'm wrong here 

I hope you can get what i need, my english is poor, sorry for that. :)

Sep 24, 2011 at 11:00 AM

I think you are looking for the InterestedIn attribute. This way, you can respond to properties and command changes in other view models.

See the documentation for an example. I hope this is what you are looking for.

Sep 24, 2011 at 12:01 PM
Edited Sep 24, 2011 at 12:04 PM

many thanks to you for your great effort :)

nice and easy Method 

    public class CustomerOrdersDetailsViewModel : Catel.MVVM.ViewModelBase
    { ......

       protected override void OnViewModelPropertyChanged(IViewModel viewModel, string propertyName)
            if (propertyName == "SelectedCustomer")
                var customerViewModel=   (ViewModel.CustomerViewModel )viewModel;
                var messageService = GetService<IMessageService>();
                var list = (new BusinessLayer.Customers_BS()).GetOrdersbyCustomer(customerViewModel.SelectedCustomer);
                Orders = new ObservableCollection<Model.Order>(list);
Sep 24, 2011 at 12:03 PM

Great that this is what you are looking for :)

One small thing, I recommend this:

if (propertyName == MyViewModelType.SelectedCustomerProperty.Name)

which is much safer in case you go refactoring.


Same for OnPropertyChanged, I recommend this:



RaisePropertyChanged(() => Orders);

Sep 24, 2011 at 12:34 PM


okthanks for your advice :)