How to send data from an opened window back to its opener in WPF.

Posted by TravisPUK on Stack Overflow See other posts from Stack Overflow or by TravisPUK
Published on 2010-04-25T15:58:10Z Indexed on 2010/04/25 16:03 UTC
Read the original article Hit count: 215

Filed under:
|
|

In WPF I have one window opening a second window that allows some data selections to occur on. Once the selections have been made I then want to submit/close the second/sub window and have the data pushed back to the opening/parent window.

I can push data into the sub window from the parent via public properties, but have not worked out how to get it back the other way. Can anyone help please?

The code I am using to open the window and set some properties is has follows:

Dim wdwContacts As New appContacts()
wdwContacts.selClientID = selClientID
wdwContacts.selEmailToCCType = selEmailToCCType
wdwContacts.pullToAddresses = txEmailTo.Text
wdwContacts.pullCCAddresses = txEmailCC.Text
wdwContacts.Owner = Me
wdwContacts.WindowStartupLocation = Windows.WindowStartupLocation.CenterOwner
wdwContacts.Show()

The basis is that I have the first window as an email composition page that has a button that when clicked brings up a list of email contacts. It brings through any previously selected email addresses from the first window and auto selects them on the sub window/email list. If further selections are made on the email list, when the op clicks the done/submit/close button it pushes the new selection list back into the relevant TextBox on the first/parent window.

Thanks

© Stack Overflow or respective owner

Related posts about wpf

Related posts about vb.net