wpf - Inserting data to XML file notify ObservableCollection -
i have parent window has listview bound observablecollection gets it's data xml file. on parent window, have add button opens opens modal window (form2.showdialog(), think modal window).
in child window have few text fields , add button, user enters data new record , clicks add button , xml file updated new record.
what seeking when child window closed listview in parent window refreshed show new record.
when updating xml file child window, doing directly xml file, should adding data file in other manner raise event on observablecollection?
i heading down path of adding event handler add button on parent window , attempt force re-read of xml file, cannot figure out how achieve this, below have done far.
form1.xaml.vb:
private sub button1_click(byval sender system.object, byval e system.windows.routedeventargs) handles button1.click dim frm new newemergencycontact addhandler frm.closed, addressof refresh_emcontacts frm.showdialog() end sub private sub refresh_emcontacts() end sub
i cannot workout should go refresh_emcontacts sub, need call kind of observablecollection event handler notify it has been updated , re-read?
any assistance appreciated.
matt
you might better off updating observablecollection directly new item, , if wish persist change xml file @ point, subscribe observablecollection's collectionchanged event , can inspect event args passed handler information item added.
Comments
Post a Comment