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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:58:35+00:00 2026-06-17T20:58:35+00:00

Just a quick one on dependency properties. I have a treeview I’m lazy loading,

  • 0

Just a quick one on dependency properties. I have a treeview I’m lazy loading, binding with an MVVM model. On the bound property IsExpanded, I have this code

public bool IsExpanded
        {
            get { return _isExpanded; }
            set
            {
                if (value != _isExpanded)
                {
                    _isExpanded = value;
                    OnPropertyChanged("IsExpanded");
                }

                // Expand all the way up to the root
                if (_isExpanded && _parent != null)
                    if (!_parent.IsExpanded) _parent.IsExpanded = true;

                // Lazy load the child items, if necessary
                if (HasDummyChild)
                {
                    LoadChildren();
                }
            }
        }

Which is fired when you click on the expand icon on the node, it then loads the children, and when that completes, it displays the child nodes expanded.

The problem is this can take a little bit of time to load, so while it is loading I want to have a single child saying something like “Please wait, loading…” and then when the LoadChildren() method completes, it then displays the actual children.

I am adding a dummy node to the children list by default, which has this display text, then calling LoadChildren and replacing that dummy list with the actual one but the issue is when you click on the expand icon, the setter fires first, which needs to fully complete before the GET data binding gets called to display the children.

So the dummy item never gets displayed, it exists in the children list but by the time the setter completes, it has been replaced and the only thing that ever gets displayed is the full list with a pause before opening it.

is there a way you can think of so that when you click the icon, it visually expands the node with the existing dummy child FIRST, and THEN tries to fetch and load the actual children?

  • 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-17T20:58:36+00:00Added an answer on June 17, 2026 at 8:58 pm

    You would need to perform the loading in a background thread. Adding the loaded children to the list however needs to be performed on the UI thread.

    Something like this:

    public void AddChildrenAsync()
    {
        var uiScheduler = TaskScheduler.FromCurrentSynchronizationContext();
        Task.Factory.Run(() => LongOperationThatReturnsTheChildren(); )
                    .ContinueWith(t =>
                                  {
                                      Children.AddRange(t.Result);
                                      Children.RemoveAt(0);
                                  }, uiScheduler);
    }
    

    In the setter:

    // Lazy load the child items, if necessary
    if (HasDummyChild)
    {
        LoadChildrenAsync();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just a quick question. I have one XML and I was hoping to tranform
Just a quick one, which is fustrating! I have three tabs which just literally
Hi guys I just have one quick question: what happens when an insert statement
just a quick question I have an array with only one object in it
Just a quick one - If I were to have a link such as
Just a quick one about installing a PHP website, are there any tools out
Just a quick one: what are peoples thoughts on using Action delegates for public
Just a quick one, hopefully. I've coded up this: <script> $(div.design-project).css('display', 'none'); function InsertContent(tid)
Just a quick preparation for my exam, for example I have: f(x) = 5x<sup>2</sup>
Just a quick one, Is there anyway to shorthand this? It's basically determining the

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.