I have an ItemType that is coming from EF. This ItemType is wrapped in a ItemTypeViewModel. Many ItemTypes are wrapped in ItemTypeViewModels and are being put in a ObservableCollection in the ViewModel for the user control that will display them:

I use the CollectionView so I can page through them. The screen looks like this:

Now I’m thinking that the buttons that are used for paging that are in the user control could better be placed in the Window that will contain the user control. So, in my user control I know have commands like this:

But I want them to be in the window. I don’t know if this will be good design, but if I will go through with this, how to relay the commands from the window to the usercontrol?
Another question I have is how to fill the combobox in the user control. They will always have the same values, but the selected item will change per ItemType.
I know two ways how to do this.
1) Add new class, for example,
MainWindowViewModeland add there 2 commands and an instance ofUserControlViewModel(you haven’t said the title, so I will call it in this way). Here is a part of example:I have used the
Lazyclass, but the main idea is clear: the code is the same, except the callthis.ChildControlViewModel.CollectionViewinstead ofCollectionView.2) Use the
Messengerclass.This way isn’t so obvious and it has only one advantage: the viewmodels are loosely connected.
I’m not sure whether this code will work correctly. And it is not easy to explain.
The
MainWindowViewModelclass send the message when a user press the button. TheUserControlViewModelclass process the message, change the position of the current item, and send theCurrentItemChangedNotificationmessage. TheMainWindowViewModelclass process this message and updates theCanExecutepart of the command.1st solution is better for me, but at the same time I use the
Messengerclass quite often. It depends on the situation.