Question: 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?

Answer: 
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());
}

```
Take a look at the binding's [IsAsync](http://msdn.microsoft.com/en-us/library/system.windows.data.binding.isasync.aspx) property. I imagine it could work in combination with a [debounce](http://ajaxian.com/archives/debounce-your-javascript-functions) like pattern.