MVVM light: Pass object from view to viewmodel
I 've recently started working with WPF using MVVM light and I have the following (simple scenario). MainWindow contains a listbox of elements. When one is selected and the button is clicked, I fire a command: ReservoirViewerCommand.Execute(null); On the viewmodel class I instantiate the command and send a message with the selected object: ReservoirViewerCommand = new RelayCommand(OpenReservoir); private void OpenReservoir() { Messenger.Default.Send(new LaunchShowReservoirMessage(){Reservoir=SelectedReservoir}); } where: class LaunchShowReservoirMessage:MessageBase { public Reservoir Reservoir