locked
White screen before loading main window contents RRS feed

  • Question

  • Hi,

    I have a WPF application, where the MainWindow contents are thumbnail images.

    Before displaying the MainWindow, I m displaying a Splash Screen.

    Once the Splash Screen closes, MainWindow should start loading thumbnails.

    But there is a gap after closing Splash Screen, a white screen is displaying for a while before displaying MainWindow.

    How to avoid the White Blank screen, so that after Splash Sceen, immediately I can show MainWindow?

    Thanks

    Vijay M Z

    Monday, July 11, 2016 12:41 PM

Answers

  • Hi Vijay,

    >>"but still there is a white screen for a short period of time."

    Is it related to your splash picture? I also don't where did the white screen come from.

    >>"Or else how can I show Splash Screen until Main Window is shown.? "

    You could create a window instead of use splash image. This allow us take more control on this splash window. Link below is for your reference.

    Implement Splash Screen with WPF

    Best Regards,
    Li Wang


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Proposed as answer by DotNet Wang Saturday, July 30, 2016 5:45 AM
    • Marked as answer by DotNet Wang Monday, August 1, 2016 1:40 AM
    Sunday, July 24, 2016 8:33 AM

All replies

  • How are you creating the Splash Screen? Is it using the standard SplashScreen build action or some other technique?

    Monday, July 11, 2016 2:17 PM
  • I don't know what "white blank screen" means exactly in this case but you should make sure that you are not executing any method but InitializeComponent() in the constructor of the main window if you want it to load immediately. You could load the thumbnails once the window has been loaded:

    public MainWindow()
            {
                InitializeComponent();
    this.Loaded += Window_Loaded;
    }
    private void Window_Loaded(object sender, RoutedEventArgs e)
            {
                //load the thumbnails here...
            }

    If your XAML markup is made up of a lot of "heavy" elements (like for example a lot of Images), it might take a while to load these and this might cause a "white blank screen" for a short period of time. If this is an issue for you, you will have to load the thumbnails one by one or something programmatically in the Loaded event of the window instead of loading all thumbnails at once when your XAML markup gets loaded.

    Hope that helps. Please provide a minimal reproducible sample of your issue if you need any further help.

    Please remember to close your threads by marking helpful posts as answer and then start a new thread if you have a new question. Please don't ask several questions in the same thread.

    Monday, July 11, 2016 6:52 PM
  • Yes, I am using Splash Screen with the standard SplashScreen build action.

    Used the same approach suggested above, moved all code from constructor to Loaded event, but still there is a white screen for a short period of time.

    Or else how can I show Splash Screen until Main Window is shown.?

    Thanks

    Tuesday, July 12, 2016 11:20 AM
  • Hi Vijay,

    >>"but still there is a white screen for a short period of time."

    Is it related to your splash picture? I also don't where did the white screen come from.

    >>"Or else how can I show Splash Screen until Main Window is shown.? "

    You could create a window instead of use splash image. This allow us take more control on this splash window. Link below is for your reference.

    Implement Splash Screen with WPF

    Best Regards,
    Li Wang


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Proposed as answer by DotNet Wang Saturday, July 30, 2016 5:45 AM
    • Marked as answer by DotNet Wang Monday, August 1, 2016 1:40 AM
    Sunday, July 24, 2016 8:33 AM