tags:

views:

84

answers:

2

Hi, I have a parent window which launches a child window, after doing some selection/ operation in the child window is closed and i want to send some info back to the parent window (a custom class object) , whats the best way to accomplish this in wpf using the features provided by wpf ?

Thanks in advance !

A: 

You have many options:

  • You could use a custom event in your child window that the parent window listens to
  • You could define a delegate in the child window that references a method in the parent window
  • You could change the constructor for the child window to take a reference to the parent window and call a method on the parent window using that reference
  • You could possibly use the VisualTreeHelper class to get the parent window and call a method on that reference
Rune Grimstad
A: 

Hi,

Please have a look at this link.

http://newbiehack.com/CSharpandWPFXAMLforChildWindowtoaParentWindowandPassingInformation.aspx

Geetha