private void Button_Click(object sender, RoutedEventArgs e) { var wnd = new CaptureWindow(); this.Visibility = Visibility.Hidden; wnd.ShowDialog(); this.Visibility = Visibility.Visible; }