Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7069105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:24:19+00:00 2026-05-28T05:24:19+00:00

i got this WPF application, and here i made a Splashscreen (wfp window) with

  • 0

i got this WPF application, and here i made a Splashscreen (wfp window) with a processbar on it. (for now i just let it run with a timer to change that later on)

so far, this all seems to work pretty well.

but, the following happens:
– I start the build from the folder (../bin/release/ )
– Splash now appears on the screen and the processbar starts to run.
– at a full bar, it will start the main application (MainWindow)
but, this main window does not start on top now, it is behind the folder from where the exe was executed (in this case the ../release/ )

i have been looking around, but dont really understand how to use the snipits i find around on the internet, and dont really think those are the right fix.
rather use a decent fix then some workaround (if possible)

so, why does this happen, and how can i change this behavior to work properly? (so that main get displayed on top (non-persistent) after splash?)

some parts of the code:
in main

using ........
//etc etc...

namespace WpfApplication1
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {

        //creating the exitmessage for use later on, after all, we want to use this in an other method.
        string exitmessage = null;



        public MainWindow()
        {
            //start new thread and use that for splashscreen.
            Thread t = new Thread(new ThreadStart(SplashScreen));
            t.SetApartmentState(ApartmentState.STA);
            t.Start();
            Thread.Sleep(5000);
            //start mainwindow
            InitializeComponent();
            //end splash proc.
            t.Abort();

           //region //check lang

        }

        public void SplashScreen()
        {
            WpfApplication1.Window4 X = new WpfApplication1.Window4();
            X.ShowDialog();
        }

        // region //etc.. app stuff

    }
}

in window4 (splash)

using .....
//etc.. etc...

namespace WpfApplication1
{
    /// <summary>
    /// Interaction logic for Window4.xaml
    /// </summary>
    public partial class Window4 : Window
    {

        System.Windows.Threading.DispatcherTimer dispatcherTimer = new System.Windows.Threading.DispatcherTimer();


        public Window4()
        {
            InitializeComponent();
            Timer1();
        }

        public void Timer1()
        {
            dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);
            dispatcherTimer.Interval = new TimeSpan(0,0,0,0,25);
            dispatcherTimer.Start();   
        }

        private void dispatcherTimer_Tick(object sender, EventArgs e) 
        {
            if (progressBar1.Value == 100)
                dispatcherTimer.Stop();
            else
                progressBar1.Value++;
        }

    }

}

hopefully someone can help me out here.
thanx!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T05:24:19+00:00Added an answer on May 28, 2026 at 5:24 am

    don’t try to display splash in you MainWindow.. right way is that you should try creating a window having no border and no resize and stay on top.. and then call that window.show() in app.cs

    here is an article defining how you can do this..

    http://romenlaw.blogspot.com/2008/07/wpf-splash-with-progressbar.html

    EDIT:

    you can subscribe to progresschange event of backgroundworker. this will be fired whenever you call worker.ReportProgress() method from DoWork eventHandler

    worker.ProgressChanged += new ProgressChangedEventHandler(worker_ProgressChanged);
    

    this line will be added after these lines in InitOperation class.

    BackgroundWorker worker = new BackgroundWorker();
    worker.DoWork+=new DoWorkEventHandler(worker_DoWork);
    

    and in event handler for DoWork you can use

    worker.ReportProgress(100);
    

    in worker_ProgressChanged event handler you can change progress of the bar.

    Regards

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got this WPF code which works... Uri iconUri = new Uri(pack://application:,,,/media/images/VS.ico, UriKind.RelativeOrAbsolute); this.Icon
I've got a WPF application which starts off with a very small window. Something
I got this error in a WPf Application when calling the InitializeComponent. In the
In a WPF application, I've got my events centralized in one class like this:
I've got this issue with my WPF application -- I'm using an ObservableCollection<T> to
I am building a WPF application, I got this weird error : Unable to
I got this code from a WPF (very simple) application that illustrate my problem
I've got a very simple WPF UserControl that looks like this: namespace MyUserControl {
I've got a very simple WPF UserControl that looks like this: namespace WpfControlLibrary1 {
Got this line of code here but its not working. private void Button_Click(object sender,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.