Search code examples
silverlightchildwindow

Show child window before InitializeComponent


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?


Solution

  • 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();
            }