Browse Source

fix problem in complex binging chain, when a null value in chain reset current value to all subsequent expression nodes, so next change is starting on clean

pull/2114/head
Andrey Kunchev 8 years ago
parent
commit
458d45bb49
  1. 12
      src/Avalonia.Base/Data/Core/ExpressionNode.cs

12
src/Avalonia.Base/Data/Core/ExpressionNode.cs

@ -88,18 +88,21 @@ namespace Avalonia.Data.Core
_subscriber(value); _subscriber(value);
} }
protected void ValueChanged(object value) protected void ValueChanged(object value) => ValueChanged(value, true);
private void ValueChanged(object value, bool notify)
{ {
var notification = value as BindingNotification; var notification = value as BindingNotification;
if (notification == null) if (notification == null)
{ {
LastValue = new WeakReference(value); LastValue = new WeakReference(value);
if (Next != null) if (Next != null)
{ {
Next.Target = new WeakReference(value); Next.Target = LastValue;
} }
else else if (notify)
{ {
_subscriber(value); _subscriber(value);
} }
@ -110,7 +113,7 @@ namespace Avalonia.Data.Core
if (Next != null) if (Next != null)
{ {
Next.Target = new WeakReference(notification.Value); Next.Target = LastValue;
} }
if (Next == null || notification.Error != null) if (Next == null || notification.Error != null)
@ -136,6 +139,7 @@ namespace Avalonia.Data.Core
} }
else else
{ {
ValueChanged(AvaloniaProperty.UnsetValue, notify:false);
_listening = false; _listening = false;
} }
} }

Loading…
Cancel
Save