public void InvalidateDependents(DependencyObject source, DependencyPropertyChangedEventArgs sourceArgs)
{
// Take a snapshot of the list to protect against re-entrancy via Add / Remove.
Dependent[] snapList = base.ToArray();
for (int i = 0; i < snapList.Length; i++)
{
Expression expression = snapList[i].Expr;
if (null != expression)
{
expression.OnPropertyInvalidation(source, sourceArgs);
// Invalidate dependent, unless expression did it already
if (!expression.ForwardsInvalidations)
{
DependencyObject dependencyObject = snapList[i].DO;
DependencyProperty dependencyProperty = snapList[i].DP;
if (null != dependencyObject && null != dependencyProperty)
{
// recompute expression
dependencyObject.InvalidateProperty(dependencyProperty);
}
}
}
}
}