|
|
@ -21,7 +21,7 @@ namespace Avalonia |
|
|
/// priority binding that doesn't return <see cref="AvaloniaProperty.UnsetValue"/>. Where there
|
|
|
/// priority binding that doesn't return <see cref="AvaloniaProperty.UnsetValue"/>. Where there
|
|
|
/// are multiple bindings registered with the same priority, the most recently added binding
|
|
|
/// are multiple bindings registered with the same priority, the most recently added binding
|
|
|
/// has a higher priority. Each time the value changes, the
|
|
|
/// has a higher priority. Each time the value changes, the
|
|
|
/// <see cref="IPriorityValueOwner.Changed(PriorityValue, object, object)"/> method on the
|
|
|
/// <see cref="IPriorityValueOwner.Changed"/> method on the
|
|
|
/// owner object is fired with the old and new values.
|
|
|
/// owner object is fired with the old and new values.
|
|
|
/// </remarks>
|
|
|
/// </remarks>
|
|
|
internal class PriorityValue |
|
|
internal class PriorityValue |
|
|
@ -30,7 +30,6 @@ namespace Avalonia |
|
|
private readonly SingleOrDictionary<int, PriorityLevel> _levels = new SingleOrDictionary<int, PriorityLevel>(); |
|
|
private readonly SingleOrDictionary<int, PriorityLevel> _levels = new SingleOrDictionary<int, PriorityLevel>(); |
|
|
|
|
|
|
|
|
private readonly Func<object, object> _validate; |
|
|
private readonly Func<object, object> _validate; |
|
|
private static readonly DeferredSetter<PriorityValue, (object value, int priority)> delayedSetter = new DeferredSetter<PriorityValue, (object, int)>(); |
|
|
|
|
|
private (object value, int priority) _value; |
|
|
private (object value, int priority) _value; |
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
@ -243,7 +242,7 @@ namespace Avalonia |
|
|
/// <param name="priority">The priority level that the value came from.</param>
|
|
|
/// <param name="priority">The priority level that the value came from.</param>
|
|
|
private void UpdateValue(object value, int priority) |
|
|
private void UpdateValue(object value, int priority) |
|
|
{ |
|
|
{ |
|
|
delayedSetter.SetAndNotify(this, |
|
|
Owner.Setter.SetAndNotify(Property, |
|
|
ref _value, |
|
|
ref _value, |
|
|
UpdateCore, |
|
|
UpdateCore, |
|
|
(value, priority)); |
|
|
(value, priority)); |
|
|
@ -256,14 +255,13 @@ namespace Avalonia |
|
|
{ |
|
|
{ |
|
|
var val = update.value; |
|
|
var val = update.value; |
|
|
var notification = val as BindingNotification; |
|
|
var notification = val as BindingNotification; |
|
|
object castValue; |
|
|
|
|
|
|
|
|
|
|
|
if (notification != null) |
|
|
if (notification != null) |
|
|
{ |
|
|
{ |
|
|
val = (notification.HasValue) ? notification.Value : null; |
|
|
val = (notification.HasValue) ? notification.Value : null; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (TypeUtilities.TryConvertImplicit(_valueType, val, out castValue)) |
|
|
if (TypeUtilities.TryConvertImplicit(_valueType, val, out object castValue)) |
|
|
{ |
|
|
{ |
|
|
var old = backing.value; |
|
|
var old = backing.value; |
|
|
|
|
|
|
|
|
|