在InitializeComponent之前显示子窗口

时间:2011-12-15 20:34:48

标签: silverlight childwindow

我有Silverlight应用程序我想在主页InitializeComponent();

之前显示登录窗口

此方法不起作用:

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

有什么建议吗?

1 个答案:

答案 0 :(得分:3)

试试这个:

public MainPage()
        {

            InitializeComponent();
            Loaded += MainPage_Loaded;
        }

 private void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            Visibility = Visibility.Collapsed;
            Login log = new Login();
            log.Show();
        }