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 9024301
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:58:23+00:00 2026-06-16T05:58:23+00:00

My ViewModel selects a view based on user click. One of the views contains

  • 0

My ViewModel selects a view based on user click. One of the views contains a lot of visual elements – viewmodels with datatemplates that contain viewmodels with datatemplates, each one renders on a canvas with a background imagebrush. The full view ends with approx 100 of these canvas brushes, each one with a dozen ellipses superimposed, and the whole view is in a scrollable viewbox.

The first time this view is created, user clicks then hangs around for some time while it’s all rendered. I’d like to get this rendering done earlier – for example during startup. I’ve created the view object, but still when the user clicks we’re hanging around while the rendering is done.

Is there any way to get WPF/xaml to pre-render it so the click response is better?

  • 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-06-16T05:58:24+00:00Added an answer on June 16, 2026 at 5:58 am

    As I see you are using MVVM pattern. I would try following aproach:

    Create the view during startup and also set its DataContext to your viewmodel instance. Then simulate the work WPF performs. Call Measure() and Arrange() methods on the view to force WPF to update data binding and generate visual tree.

    But there is only one UI thread. So at this point blocks your startup routine again. You could avoid this by splitting the “work” in smaller pieces. Maybe you have some collection of items in your view model. Then you can use DipatcherTimer and in each step add some reasonable amount of items to the collection and call Measure and Arrange after each iteration to update the visual tree of the view.
    After the view is fully initialized, the rendering shouldn’t block any more.

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

Sidebar

Related Questions

I have a ViewModel class that contains a list of points, and I am
I have a view that allows the user to select some data : some
Here's simple view model that I use: public class ViewModel { public Order Order
I have one property on my view model that is used in a select
When I show a list of testplanViewModels in my View and the user selects
I have a view that contains a list of items, a TextBox and a
I have a View / ViewModel where a ProductList is loaded. This list is
I have a ViewModel I am binding to a view: ProductViewModel model = Mapper.Map<Product,
Is Model-View-ViewModel the best pattern to use in WPF? Are there any downsides?
And again a newbie question. ;-) I am setting my View Model based on

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.