Cannot reuse wpf window after closing

后端 未结 3 1989
天涯浪人
天涯浪人 2021-01-15 10:10

I am using a window to change database configuration for my application. Settings button click is handeled by Config(), it show settings windows when clicked. If I close the

相关标签:
3条回答
  • 2021-01-15 10:16

    You can't. Just create a new window.

    0 讨论(0)
  • 2021-01-15 10:19
    ConfigDialogBox configDlg = null;
    
    
    
    private void Config(object sender, RoutedEventArgs e)
            {            
             configDlg = new ConfigDialogBox();
                configDlg.Show();
                configDlg.okButton.Click+=new RoutedEventHandler(SettingsChanged);
                configDlg.cancelButton.Click+=new RoutedEventHandler(SettingsChanged);
            }
    
    0 讨论(0)
  • 2021-01-15 10:36

    You can't reuse the window.

    If closing the window via something other than OK and Cancel buttons is your problem, you need to handle the Window.Closing event (see the link for an example).

    0 讨论(0)
提交回复
热议问题