|
|
|
@ -339,9 +339,6 @@ namespace Avalonia |
|
|
|
|
|
|
|
var description = GetDescription(source); |
|
|
|
|
|
|
|
var scheduler = AvaloniaLocator.Current.GetService<IScheduler>() ?? ImmediateScheduler.Instance; |
|
|
|
source = source.ObserveOn(scheduler); |
|
|
|
|
|
|
|
if (property.IsDirect) |
|
|
|
{ |
|
|
|
if (property.IsReadOnly) |
|
|
|
@ -743,29 +740,41 @@ namespace Avalonia |
|
|
|
/// <param name="value">The value.</param>
|
|
|
|
private void SetDirectValue(AvaloniaProperty property, object value) |
|
|
|
{ |
|
|
|
var notification = value as BindingNotification; |
|
|
|
|
|
|
|
if (notification != null) |
|
|
|
void Set() |
|
|
|
{ |
|
|
|
notification.LogIfError(this, property); |
|
|
|
value = notification.Value; |
|
|
|
} |
|
|
|
var notification = value as BindingNotification; |
|
|
|
|
|
|
|
if (notification == null || notification.ErrorType == BindingErrorType.Error || notification.HasValue) |
|
|
|
{ |
|
|
|
var metadata = (IDirectPropertyMetadata)property.GetMetadata(GetType()); |
|
|
|
var accessor = (IDirectPropertyAccessor)GetRegistered(property); |
|
|
|
var finalValue = value == AvaloniaProperty.UnsetValue ? |
|
|
|
metadata.UnsetValue : value; |
|
|
|
if (notification != null) |
|
|
|
{ |
|
|
|
notification.LogIfError(this, property); |
|
|
|
value = notification.Value; |
|
|
|
} |
|
|
|
|
|
|
|
LogPropertySet(property, value, BindingPriority.LocalValue); |
|
|
|
if (notification == null || notification.ErrorType == BindingErrorType.Error || notification.HasValue) |
|
|
|
{ |
|
|
|
var metadata = (IDirectPropertyMetadata)property.GetMetadata(GetType()); |
|
|
|
var accessor = (IDirectPropertyAccessor)GetRegistered(property); |
|
|
|
var finalValue = value == AvaloniaProperty.UnsetValue ? |
|
|
|
metadata.UnsetValue : value; |
|
|
|
|
|
|
|
accessor.SetValue(this, finalValue); |
|
|
|
LogPropertySet(property, value, BindingPriority.LocalValue); |
|
|
|
|
|
|
|
accessor.SetValue(this, finalValue); |
|
|
|
} |
|
|
|
|
|
|
|
if (notification != null) |
|
|
|
{ |
|
|
|
UpdateDataValidation(property, notification); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (notification != null) |
|
|
|
if (Dispatcher.UIThread.CheckAccess()) |
|
|
|
{ |
|
|
|
Set(); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
UpdateDataValidation(property, notification); |
|
|
|
Dispatcher.UIThread.InvokeAsync(Set); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|