Reputation: 305
I'm currently developing a WPF application using the MVVM framework. And I have this functionality:
I have a main window which has a combo box and frame (where I put my pages) and a view model. One of the pages in that frame is where a user can add a data and these data are used to populate the combo box in the main window. My problem is how to automatically update the items in the combo box after adding a data from that page. Btw, this page has a different view model too.
Thanks.
Upvotes: 0
Views: 621
Reputation: 1253
You can pass the Source DataContext of ComboBox (ObservableCollection) to page ViewModel so you can simply modify the collection from Page view model.
Upvotes: 0
Reputation: 13458
You can establish an event in the page viewmodel for changed data. Then subscribe to those events within the window viewmodel and update the combobox items accordingly.
Upvotes: 1
Reputation: 709
You have access to the parent window from iframe via window.top. You have to write this code in your page what you have loaded in iFrame.
window.top.document.getElementById("combobox_element_id").value='Your New Value';
best of luck
Upvotes: 0