I\'m working on some application and I have one problem. I have two windows (Bookings - parent and Guests - child). In the parent window, I have one combo box with list of guest
Just use your already existent connection to your GuestViewModel
from your BookingsViewModel
.
The following suggestion is not tested but you will get the idea
public ICommand btnAddGuest // Command for opening child window
{
get
{
if (_btnAddGuest == null)
{
_btnAddGuest = new DelegateCommand(delegate()
{
try
{
Guests guest = new Guests();
guest.ShowDialog();
// Add some Logic here and an is save check property to your GuestVM
// sample solution
// var vm = guest.DataContext as GuestViewModel;
// if(vm != null)
// if(vm.IsSaved)
// {
// var model = vm.Guest as tblGuest;
// Guests.Add(model); // will add him to your list
// Guest = model // will add him at your selected Guest
// }
}
catch
{
Trace.WriteLine("working...", "MyApp");
}
});
}
return _btnAddGuest;
}
}