|
|
@@ -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)
|
|
|
{
|
|
|
- _valueEntry?.Unsubscribe();
|
|
|
- _valueEntry = null;
|
|
|
+ ValueEntry?.Unsubscribe();
|
|
|
+ ValueEntry = null;
|
|
|
}
|
|
|
|
|
|
if (BasePriority == BindingPriority.Unset)
|
|
|
{
|
|
|
- _baseValueEntry?.Unsubscribe();
|
|
|
- _baseValueEntry = null;
|
|
|
+ BaseValueEntry?.Unsubscribe();
|
|
|
+ BaseValueEntry = 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(_valueEntry is not null);
|
|
|
- _baseValueEntry = _valueEntry;
|
|
|
- _valueEntry = null;
|
|
|
+ Debug.Assert(ValueEntry is not null);
|
|
|
+ BaseValueEntry = ValueEntry;
|
|
|
+ ValueEntry = null;
|
|
|
}
|
|
|
|
|
|
- if (_valueEntry != entry)
|
|
|
+ if (ValueEntry != entry)
|
|
|
{
|
|
|
- _valueEntry?.Unsubscribe();
|
|
|
- _valueEntry = entry;
|
|
|
+ ValueEntry?.Unsubscribe();
|
|
|
+ ValueEntry = 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 (_baseValueEntry != entry)
|
|
|
+ if (BaseValueEntry != entry)
|
|
|
{
|
|
|
- _baseValueEntry?.Unsubscribe();
|
|
|
- _baseValueEntry = entry;
|
|
|
+ BaseValueEntry?.Unsubscribe();
|
|
|
+ BaseValueEntry = entry;
|
|
|
}
|
|
|
}
|
|
|
- else if (_valueEntry != entry)
|
|
|
+ else if (ValueEntry != entry)
|
|
|
{
|
|
|
// Both the current value and the new value are non-animation values, so the new
|
|
|
// entry replaces the existing entry.
|
|
|
- _valueEntry?.Unsubscribe();
|
|
|
- _valueEntry = entry;
|
|
|
+ ValueEntry?.Unsubscribe();
|
|
|
+ ValueEntry = entry;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- protected void UnsubscribeValueEntries()
|
|
|
- {
|
|
|
- _valueEntry?.Unsubscribe();
|
|
|
- _baseValueEntry?.Unsubscribe();
|
|
|
- }
|
|
|
}
|
|
|
}
|