MVVM - "Add New" Window
Posted on 2011-03-20
I am using MVVM / WPF in my solution. I would like to be able to click on a "Add Address" button to open a new window and allow the user to add a new address. Of course the address must be linked to a particular Organisation.
This is what I have working already
1) I have a Organisation details form which has the Main Organisation Details, Addresses, Contacts.
2) I have the following. All of which are working in isolation.
"Organisation Details" View / ViewModel,
"Organisation" View / ViewModel
"Address List" View / ViewModel
"Address View" View / ViewModel.
3) The Organisation Details View Model contains the Organisational View Model and the Address List View Model.
I pass in a reference to the Organisation into the both of these models. The address list uses this to get the addresses for that organisation.
4) I can currently see and edit the Organisation and edit the existing addresses.
What I need now is to open a new window to allow the user to add a new address.
Q1) How and where do I place the code to open the new window
Q2) How and where do I pass in the current Organisation Reference to the new window so the new address gets added to the Organisation.