|
@@ -1,5 +1,6 @@
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
+using System.ComponentModel;
|
|
|
using System.Diagnostics;
|
|
|
using System.Diagnostics.CodeAnalysis;
|
|
|
using System.Linq;
|
|
@@ -590,10 +591,13 @@ namespace Avalonia.PropertyStore
|
|
|
return;
|
|
|
|
|
|
var count = children.Count;
|
|
|
+
|
|
|
+ var apArgs = new AvaloniaPropertyChangedEventArgs<T>(Owner, property, oldValue, value.Value, BindingPriority.Inherited, true);
|
|
|
+ var incpArgs = new PropertyChangedEventArgs(property.Name);
|
|
|
|
|
|
for (var i = 0; i < count; ++i)
|
|
|
{
|
|
|
- children[i].GetValueStore().OnAncestorInheritedValueChanged(property, oldValue, value.Value);
|
|
|
+ children[i].GetValueStore().OnAncestorInheritedValueChanged(apArgs, incpArgs);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -614,9 +618,12 @@ namespace Avalonia.PropertyStore
|
|
|
{
|
|
|
var count = children.Count;
|
|
|
|
|
|
+ var apArgs = new AvaloniaPropertyChangedEventArgs<T>(Owner, property, oldValue, newValue, BindingPriority.Inherited, true);
|
|
|
+ var incpArgs = new PropertyChangedEventArgs(property.Name);
|
|
|
+
|
|
|
for (var i = 0; i < count; ++i)
|
|
|
{
|
|
|
- children[i].GetValueStore().OnAncestorInheritedValueChanged(property, oldValue, newValue);
|
|
|
+ children[i].GetValueStore().OnAncestorInheritedValueChanged(apArgs, incpArgs);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -639,33 +646,24 @@ namespace Avalonia.PropertyStore
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// Called when an inherited property changes on the value store of the inheritance ancestor.
|
|
|
/// </summary>
|
|
|
/// <typeparam name="T">The property type.</typeparam>
|
|
|
- /// <param name="property">The property.</param>
|
|
|
- /// <param name="oldValue">The old value of the property.</param>
|
|
|
- /// <param name="newValue">The new value of the property.</param>
|
|
|
- public void OnAncestorInheritedValueChanged<T>(
|
|
|
- StyledProperty<T> property,
|
|
|
- T oldValue,
|
|
|
- T newValue)
|
|
|
+ /// <param name="apArgs">Avalonia Property EventArgs to reuse.</param>
|
|
|
+ /// <param name="args">PropertyChangedEventArgs to reuse</param>
|
|
|
+ public void OnAncestorInheritedValueChanged<T>(AvaloniaPropertyChangedEventArgs<T> apArgs, PropertyChangedEventArgs? args)
|
|
|
{
|
|
|
- Debug.Assert(property.Inherits);
|
|
|
-
|
|
|
+
|
|
|
// If the inherited value is set locally, propagation stops here.
|
|
|
- if (_effectiveValues.ContainsKey(property))
|
|
|
+ if (_effectiveValues.ContainsKey(apArgs.Property))
|
|
|
return;
|
|
|
|
|
|
- using var notifying = PropertyNotifying.Start(Owner, property);
|
|
|
+ using var notifying = PropertyNotifying.Start(Owner, apArgs.Property);
|
|
|
|
|
|
- Owner.RaisePropertyChanged(
|
|
|
- property,
|
|
|
- oldValue,
|
|
|
- newValue,
|
|
|
- BindingPriority.Inherited,
|
|
|
- true);
|
|
|
+ apArgs.SetSender(Owner);
|
|
|
+ Owner.RaisePropertyChanged(apArgs, args);
|
|
|
|
|
|
var children = Owner.GetInheritanceChildren();
|
|
|
|
|
@@ -676,7 +674,7 @@ namespace Avalonia.PropertyStore
|
|
|
|
|
|
for (var i = 0; i < count; ++i)
|
|
|
{
|
|
|
- children[i].GetValueStore().OnAncestorInheritedValueChanged(property, oldValue, newValue);
|
|
|
+ children[i].GetValueStore().OnAncestorInheritedValueChanged(apArgs, args);
|
|
|
}
|
|
|
}
|
|
|
|