@ -22,27 +22,11 @@ namespace Avalonia
/// </remarks>
public class AvaloniaObject : IAvaloniaObject , IAvaloniaObjectDebug , INotifyPropertyChanged
{
/// <summary>
/// The parent object that inherited values are inherited from.
/// </summary>
private IAvaloniaObject _ inheritanceParent ;
/// <summary>
/// Maintains a list of direct property binding subscriptions so that the binding source
/// doesn't get collected.
/// </summary>
private List < DirectBindingSubscription > _d irectBindings ;
/// <summary>
/// Event handler for <see cref="INotifyPropertyChanged"/> implementation.
/// </summary>
private PropertyChangedEventHandler _ inpcChanged ;
/// <summary>
/// Event handler for <see cref="PropertyChanged"/> implementation.
/// </summary>
private EventHandler < AvaloniaPropertyChangedEventArgs > _ propertyChanged ;
private EventHandler < AvaloniaPropertyChangedEventArgs > _ inheritablePropertyChanged ;
private ValueStore _ values ;
private ValueStore Values = > _ values ? ? ( _ values = new ValueStore ( this ) ) ;
@ -98,6 +82,15 @@ namespace Avalonia
remove { _ inpcChanged - = value ; }
}
/// <summary>
/// Raised when an inheritable <see cref="AvaloniaProperty"/> value changes on this object.
/// </summary>
event EventHandler < AvaloniaPropertyChangedEventArgs > IAvaloniaObject . InheritablePropertyChanged
{
add { _ inheritablePropertyChanged + = value ; }
remove { _ inheritablePropertyChanged - = value ; }
}
/// <summary>
/// Gets or sets the parent object that inherited <see cref="AvaloniaProperty"/> values
/// are inherited from.
@ -118,8 +111,9 @@ namespace Avalonia
{
if ( _ inheritanceParent ! = null )
{
_ inheritanceParent . PropertyChanged - = ParentPropertyChanged ;
_ inheritanceParent . Inheritable PropertyChanged - = ParentPropertyChanged ;
}
var properties = AvaloniaPropertyRegistry . Instance . GetRegistered ( this )
. Concat ( AvaloniaPropertyRegistry . Instance . GetRegisteredAttached ( this . GetType ( ) ) ) ;
var inherited = ( from property in properties
@ -144,7 +138,7 @@ namespace Avalonia
if ( _ inheritanceParent ! = null )
{
_ inheritanceParent . PropertyChanged + = ParentPropertyChanged ;
_ inheritanceParent . Inheritable PropertyChanged + = ParentPropertyChanged ;
}
}
}
@ -509,6 +503,11 @@ namespace Avalonia
PropertyChangedEventArgs e2 = new PropertyChangedEventArgs ( property . Name ) ;
_ inpcChanged ( this , e2 ) ;
}
if ( property . Inherits )
{
_ inheritablePropertyChanged ? . Invoke ( this , e ) ;
}
}
finally
{