private void MyWindow02button_Click(object sender, RoutedEventArgs e) { try { var myWindow02 = new MyWindow02(); //myWindow02.Show(); myWindow02.ShowDialog(); //別ウィンドウが閉じるまで、呼び出し元は非アクティブ } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void open01_Click(object sender, RoutedEventArgs e) { try { ((MyWindow01)((Button)sender).DataContext).Visibility = Visibility.Hidden; MyWindow02 counterSalesWindow = new MyWindow02(); counterSalesWindow.ShowDialog(); ((MyWindow01)((Button)sender).DataContext).Visibility = Visibility.Visible; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void MyWindow02button_Click(object sender, RoutedEventArgs e) { try { //呼び出し元の画面を非表示 //((MainWindow)((Button)sender).DataContext).Visibility = Visibility.Hidden; var myWindow02 = new MyWindow02(); //myWindow02.Show(); myWindow02.ShowDialog(); //別ウィンドウが閉じるまで、呼び出し元は非アクティブ //呼び出し元の画面を表示 //((MainWindow)((Button)sender).DataContext).Visibility = Visibility.Visible; } catch (Exception ex) { MessageBox.Show(ex.Message); } }