Cynthia

Cynthia

  • 1.4k
  • 215
  • 34.2k

Startup of Application Exception Can't find resource named

May 19 2017 5:45 AM
Hi I am new to WPF , 
In my WPF MVVM application , before starting of application there are some conditions to check  after which homewindow screen will come other wise login screen will come . 
The code which i have written is like this -:
public App()
{
if (System.Configuration.ConfigurationManager.AppSettings.Count > 0)
{
app.MainWindow homeWindow = new app.MainWindow();
var app = new Application();
app.Run(homeWindow);
}
else
{
LoginWindow mainWindow = new LoginWindow();
var app = new Application();
app.Run(mainWindow);
}
 
 
If i run it normally like Startup URI="LoginWindow.xaml" without anycondition , loginscreen window is coming but when i am using as i have stated in the code its throwing exception, Can't find named resource . Resources are case sensitive at one of my static resource.
 
Why that exception is coming?
 

Answers (2)