WPF Error when implementing Login.xaml
Posted
by LnDCobra
on Stack Overflow
See other posts from Stack Overflow
or by LnDCobra
Published on 2010-03-15T14:55:08Z
Indexed on
2010/03/15
14:59 UTC
Read the original article
Hit count: 535
I am getting the following exception:
"Nullable object must have a value"
Everything was working when I was using
StartupURI="MainWindow.xaml
"
but I wanted to implement a login screen so I changed this to
Startup="Application_Startup"
and then created the following method in App.xaml.cs:
private void Application_Startup(object sender, StartupEventArgs e)
{
UpdateAccounts();
bool result = true;
///*
LoginWindow login = new LoginWindow();
result = login.ShowDialog().Value;
/* */
if (!result)
{
return;
}
MainWindow window = new MainWindow();
bool main = window.ShowDialog().Value;
}
Does anyone have any idea what is going on? Or any suggestions on what is the best practice for implementing login interface.
© Stack Overflow or respective owner