How to use .NET 4 SplashScreen in a WPF Prism based application?
-
Sunday, October 16, 2011 7:26 PM
I am trying to use a .NET 4 SplashScreen in a Prism based WPF application. I have used the SpashScreen by setting the build action on the image to SplashScreen.
The application used to keep on crashing with a System.Resources.MissingManifestResourceException. Finally I figured out that if I add a StartupUri="MainWindow.xaml" in the App.Xaml file, the SplashScreen works fine.
<Application x:Class="Application"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"StartupUri="MainWindow.xaml"></Application>
But in a prism application, we cannot have a StartupUri. Everything is done in the Bootstrapper.
The complete exception message is: System.Resources.MissingManifestResourceException was unhandled
Message=Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "Application.g.resources" was correctly embedded or linked into assembly "Application" at compile time, or that all the satellite assemblies required are loadable and fully signed.
So what do I need to do manually that StartupUri did to make the SplashScreen work?
- Edited by Ganesh Rao Sunday, October 16, 2011 7:27 PM
All Replies
-
Monday, October 17, 2011 9:23 AM
Hello,
Have you tried this approach: http://msdn.microsoft.com/en-us/library/cc656886.aspx ?
Cornel Croitoriu - Senior Software DeveloperIf this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"
-
Monday, October 17, 2011 9:40 AMModerator
In WPF, we could set one SplashScreen simply, just change one image file "Build Action" to "SplashScreen".
However, for the Prism. You could add the code in the App OnStartup method as:
protected override void OnStartup(StartupEventArgs e) { SplashScreen splashScreen = new SplashScreen("splashscreen.png"); splashScreen.Show(true); base.OnStartup(e); Bootstrapper bootstrapper = new Bootstrapper(); bootstrapper.Run(); }
"splashscreen.png" is one image in the project, and its "Build Action" is "Resource".Please check out my simple sample here: https://skydrive.live.com/?cid=51b2fdd068799d15#!/?cid=51b2fdd068799d15&sc=documents&uc=1&id=51B2FDD068799D15%21847
Sincerely,
Bob Bao [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.

- Marked As Answer by Ganesh Rao Monday, October 17, 2011 4:56 PM

