Just make a overload constructor which takes parameters of the window in which you want to retrieve.
Example
Suppose we want a user to login from our Main Window( i.e Login Window ) and we want to pass an int ID / string Email to our second form to retrieve data of logging user. Than We have to first overload our second wpf form constructor.
Use can either make default constructor to do this or make an overload constructor for this work.
SecondForm:
- public secondForm()
- {
-
- }
- public secondForm(string email_ )
- {
-
- }
Now in MainWindow from where we are logging and passing our EMail
MainWindow:
- public void btnLogin()
- {
-
-
- SecondWindow sw = new SecondWindow(txtBoxEMail.Content);
- sw.Show();
- }