Kurubaran
Kurubaran

Reputation: 8902

WPF SplashScreen class can not locate the embedded image

I'm trying to display splash screen for my WPF application. Based on some condition I have to load one of two images I have created. So i have to use SplashScreen class instead of setting a static image as flashscreen. Which is easy and works in my case.

I'm doing something like following,(I have set the both images as Embedded Resource)

string splashImage = string.Empty;
if (Condition)
  {
    splashImage = "ApplicationType1.png";
  }
else
  {
    splashImage = "ApplicationType2.png";
  }

SplashScreen screen = new SplashScreen(splashImage);
screen.Show(true);

Which gives me exeception,

Cannot locate resource ApplicationType1.png

Upvotes: 2

Views: 3330

Answers (1)

Kurubaran
Kurubaran

Reputation: 8902

Finally i figured it out,

Problem was with the .png image i have added. Still i have no clue why it couldn't load that specific image. I just got the .jpg image and it works fine.

And it works with both build actions Embedded Resource or Resource

Upvotes: 5

Related Questions