Это будет работать в WinForms, а не в WPF-окне.
Попробуйте вместо этого добавить параметр.А затем прочитайте его после закрытия нового окна (или добавьте обработчик событий для немедленного обновления).
820File.cs
MyWindow w = new MyWindow();
w.MyProperty = "Now importing blah"; // Here we set the initial text
w.ShowDialog(); // Show a modal dialog so this class waits for the changed text
string changedText = w.MyProperty; // Here we read the changed text
MyWindow
public partial class Mywindow : Window
{
public string MyProperty { get; set; }
public MyWindow()
{
}
private void btnOk_Click(object sender, RoutedEventArgs e)
{
MyProperty = "Some new text"; // Set the text to something new
this.Close();
}
}