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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:54:13+00:00 2026-05-25T22:54:13+00:00

I have made a control which has a property that is calculated by using

  • 0

I have made a control which has a property that is calculated by using a few other properties as input. When any of these input properties change, the property needs to be updated. I already have made this possible through implementing property-changed events for them, marking the dependent property as updated. Changing 3 properties means 3 property refreshes.

The problem I am experiencing is that when more than one of these properties change, the dependency property is updated each time any of these properties is changed. The property however takes some time to calculate (and/or render). When more than one property is going to be changed, I would like to let it update only once, after I have updated all the properties.

Goal: The control needs to be updated only when the program is done changing all the properties.

What I have tried:

  • Make the property lazy by only updating it when requested. (Does not work, WPF requests it anyway);
  • Cache the result of the calculation. (Does not work because there is always 1 input changed, making the cache invalid);
  • Make a method to set multiple properties at once. (Does not work, some properties are inherited and come from another control);
  • Make the control collapsed before manipulating the properties. (Does not work, WPF still refreshes the properties).

Does anybody have a better solution?

  • 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-25T22:54:14+00:00Added an answer on May 25, 2026 at 10:54 pm

    You can postpone raising the property changed event. Or create a method that will stop propagating this event (i.e. StartUpdating) and another method that will fire all the events (i.e. EndUpdating).

    private bool _isUpdating;
    private List<string> _properties = ...;
    
    private void RaisePropertyChanged(string propertyName)
    {
       if(_isUpdating) 
       {
         if(!_properties.Contains(propertyName)) _properties.Add(propertyName);
         return;
       } 
    
       PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
    }
    
    void StartUpdating() { _isUpdating = true; }
    
    void EndUpdating()
    {
      _isUpdating = false;
      foreach(var propertyName in _properties) RaisePropertyChanged(propertyName);
    }
    

    and in your methods

    void LongRunningMethodSync()
    {
      try
      {
        StartUpdating(); 
        // do something synchronously
      }
      finally
      {
        EndUpdating();
      }
    }
    
    void LongRunningMethodAsync()
    {
      StartUpdating(); 
      ExecuteMyAsyncTask(done => EndUpdating());
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a user control which has a number of properties. This user control
I have made a basic ascx control which is just a panel with a
I have written an ActiveX control in C# and have made it working using
I have made a new windows service which works fine using barebone code (just
.Net 3.5, using C# I have an instance of a class (A) that has
I have a complex WPF UserControl made of other ContentControl templates which contain sets
I have custom-made wizard system which so far has been quite suitable. For most
i have made a very simple labview VI which has an activeX component in
i've made a C# winforms application. Now i have a form which has lots
I am working in an android tab which has tabs activities, I have made

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.