From de8171f8ac2221095bd9129636d754194992884b Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Thu, 6 Aug 2020 17:13:49 +0200 Subject: [PATCH] Correctly handle UnsetValue/DoNothing in setters. Just need to call `BindingValue.FromUntyped` instead of doing a conditional, because otherwise we run the risk of passing `UnsetValue` to the `BindingValue` ctor which will throw in that case. --- src/Avalonia.Styling/Styling/PropertySetterBindingInstance.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Avalonia.Styling/Styling/PropertySetterBindingInstance.cs b/src/Avalonia.Styling/Styling/PropertySetterBindingInstance.cs index e177993d13..929f7142bb 100644 --- a/src/Avalonia.Styling/Styling/PropertySetterBindingInstance.cs +++ b/src/Avalonia.Styling/Styling/PropertySetterBindingInstance.cs @@ -164,7 +164,7 @@ namespace Avalonia.Styling private void ConvertAndPublishNext(object? value) { - _value = value is T v ? v : BindingValue.FromUntyped(value); + _value = BindingValue.FromUntyped(value); if (_isActive) {