You can set the focus to mainwindow on
Closed event of
sub_window1 in MainWindow.Xaml.Cs
private void Button_Click_1(object sender, RoutedEventArgs e)
{
sub_window1 sub_window1 =new sub_window1();
sub_window1.Owner = this;
sub_window1.WindowStartupLocation = WindowStartupLocation.CenterOwner;
sub_window1.Show();
sub_window1.Closed += sub_window1_Closed;
}
void sub_window1_Closed(object sender, EventArgs e)
{
this.Focus();
}
Hope this will help you..