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

  • SEARCH
  • Home
  • 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 6009097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:55:20+00:00 2026-05-23T01:55:20+00:00

I have a WPF Window which takes a lot of time to create and

  • 0

I have a WPF Window which takes a lot of time to create and show. The user should be able to open one ore more of this windows.
Now, I am searching a way to improve the performance. One Idea is to create two of this Windows at the startup of the Application (when It shows the splash-screen). After I have only to show and hide this windows (and change the attached viewmodel). This should not be a problem. But when the user is working with the application and he uses the two windows which are loaded at startup of the application, I should load a third instance of the window in background. Now, the application should no be blocked when It loads the third one (or the 4. oder 5. etc.). Now, I am searching a way to do this. Would it be possible to load the window in another thread and after transfer it to the main UI thread?
Or are there other scenarios to reach the goal?

Thanks for any help.

Best Regards, Thomas

  • 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-23T01:55:21+00:00Added an answer on May 23, 2026 at 1:55 am

    When you create a WPF object — Window, UserControl, or anything else that descends from DispatcherObject — it locks itself to the thread it was created on. So you can’t load the window in a background thread and then transfer it to the main UI thread. If you’re going to create it in a background thread, it needs to stay on that thread; it needs to be shown by that thread, and have a message pump on that thread.

    But that’s viable. You could start a background thread, create your window there, and then wait for the main thread to say, “Okay, it’s time to show the window”. Then your thread could call Application.Run to start its own message pump, and shut itself down when the window closes.

    Of course, multithreading opens up all kinds of new complications. You probably need a dedicated thread for each window (the thread pool isn’t likely to work for this). You need to handle all the inter-thread communication. If the windows access any shared data, you need to protect it with some sort of locking. You need to make sure the application exits when it should (and if that means “when all the windows are closed”, then you need to make sure you protect the “count of open windows” resource). There are probably other complications as well. Don’t enter into this lightly.

    Your best bet, as others have said, is to profile your code and try to address your performance problems first. But if you’re convinced that you’ve done as much performance work as you can, multithreading and background loading could be an option to explore.

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

Sidebar

Related Questions

I have an app where I create a Window in WPF that the user
I have a wpf staff creation window in which I can create basic information
I have a WPF window, which contains a button called Cancel. Under ordinary circumstances
I am new to WPF. I have a code which displays a UI window
Consider this scenario; suppose I have WPF window which have four objects bonded to
I have a wpf window which is used to add as well as edit
I have a lot of buttons on a WPF window. To avoid coding the
I have developed wpf application which calls a lot of processes and windows services
I have a WPF window, which contains a Canvas object (name: canvas). When the
I have a WPF Window which has a among other controls hosts a Frame.

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.