开发者

Silverlight closing UserControl Childwindow

On my project I show a Usercontrol childwindow for logging in. Now when I want to submit the login values (username, password) the content of that childwindow has become null... You prob think that I made it a 2nd time but no...

Here is my code for creating the childwindow. And for closing it (that's where it fails)

public void openLoginWindow()
        {            
            if (login == false)
            {
                window.Content = new LoginView();
                window.HasCloseButton = false;

                window.Show();
            }
            el开发者_C百科se
            {

                window.Close();
            }

        }

Thank's for the help

Evert


what is that LoginView object? Is it a custom usercontrol? I'm not sure how your system is working but what I would do is create a specific childwindow for logging in (in that childwindow you can use your LoginView object if you want). Then in code :

public void openLoginWindow()
{
   LoginChildWindow dlg = new LoginChildWindow();
   dlg.HasCloseButton = false;
   dlg.Closed += new EventHandler(dlg_Closed);

   dlg.Show();
}

void dlg_Closed(object sender, EventArgs e)
{
            LoginChildWindow dlg = ((LoginChildWindow)sender);
            dlg.Closed -= dlg_Closed;

            //Retrieve your values here
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜