Show child window before InitializeComponent

2019-08-03 09:12发布

I have Silverlight application i want to show login window before main page InitializeComponent();

this method does not works:

public MainPage()
        {
            Login log = new Login();
            log.Show();
            InitializeComponent();
        }

Any advice?

1条回答
贪生不怕死
2楼-- · 2019-08-03 10:16

Try this:

public MainPage()
        {

            InitializeComponent();
            Loaded += MainPage_Loaded;
        }

 private void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            Visibility = Visibility.Collapsed;
            Login log = new Login();
            log.Show();
        }
查看更多
登录 后发表回答