@ -11,9 +11,6 @@ namespace Avalonia.PropertyStore
/// </remarks>
internal abstract class EffectiveValue
{
private IValueEntry ? _ valueEntry ;
private IValueEntry ? _ baseValueEntry ;
/// <summary>
/// Gets the current effective value as a boxed value.
/// </summary>
@ -29,6 +26,16 @@ namespace Avalonia.PropertyStore
/// </summary>
public BindingPriority BasePriority { get ; protected set ; }
/// <summary>
/// Gets the active value entry for the current effective value.
/// </summary>
public IValueEntry ? ValueEntry { get ; private set ; }
/// <summary>
/// Gets the active value entry for the current base value.
/// </summary>
public IValueEntry ? BaseValueEntry { get ; private set ; }
/// <summary>
/// Gets a value indicating whether the <see cref="Value"/> was overridden by a call to
/// <see cref="AvaloniaObject.SetCurrentValue{T}"/>.
@ -63,14 +70,14 @@ namespace Avalonia.PropertyStore
{
if ( Priority = = BindingPriority . Unset )
{
_ v alueEntry? . Unsubscribe ( ) ;
_ v alueEntry = null ;
V alueEntry? . Unsubscribe ( ) ;
V alueEntry = null ;
}
if ( BasePriority = = BindingPriority . Unset )
{
_ b aseValueEntry? . Unsubscribe ( ) ;
_ b aseValueEntry = null ;
B aseValueEntry? . Unsubscribe ( ) ;
B aseValueEntry = null ;
}
}
@ -135,40 +142,34 @@ namespace Avalonia.PropertyStore
// value, then the current entry becomes our base entry.
if ( Priority > BindingPriority . LocalValue & & Priority < BindingPriority . Inherited )
{
Debug . Assert ( _ v alueEntry is not null ) ;
_ baseValueEntry = _ v alueEntry;
_ v alueEntry = null ;
Debug . Assert ( V alueEntry is not null ) ;
BaseValueEntry = V alueEntry;
V alueEntry = null ;
}
if ( _ v alueEntry ! = entry )
if ( V alueEntry ! = entry )
{
_ v alueEntry? . Unsubscribe ( ) ;
_ v alueEntry = entry ;
V alueEntry? . Unsubscribe ( ) ;
V alueEntry = entry ;
}
}
else if ( Priority < = BindingPriority . Animation )
{
// We've received a non-animation value and have an active animation value, so the
// new entry becomes our base entry.
if ( _ b aseValueEntry ! = entry )
if ( B aseValueEntry ! = entry )
{
_ b aseValueEntry? . Unsubscribe ( ) ;
_ b aseValueEntry = entry ;
B aseValueEntry? . Unsubscribe ( ) ;
B aseValueEntry = entry ;
}
}
else if ( _ v alueEntry ! = entry )
else if ( V alueEntry ! = entry )
{
// Both the current value and the new value are non-animation values, so the new
// entry replaces the existing entry.
_ v alueEntry? . Unsubscribe ( ) ;
_ v alueEntry = entry ;
V alueEntry? . Unsubscribe ( ) ;
V alueEntry = entry ;
}
}
protected void UnsubscribeValueEntries ( )
{
_ valueEntry ? . Unsubscribe ( ) ;
_ baseValueEntry ? . Unsubscribe ( ) ;
}
}
}