I am trying to pass a string to a new window when it is opened and it is not working. Here is the code in Window 1;
Window 1
private void myButton_Click(object sender, RoutedEventArgs e)
{
var newMyWindow2 = new myWindow2();
newMyWindow2.Show();
newMyWindow2.myString = "The great String Value";
}
In Windows 2 here is my declaration of the string;
Windows 2
public partial class myWindow2 : Window
{
public string myString { get; set; }
}
When I run it the string is coming out NULL. Why is this?