From 72fd5f01056b2c74d9b3b181e3f8ad6f6de99696 Mon Sep 17 00:00:00 2001 From: Giuseppe Lippolis Date: Mon, 22 Nov 2021 15:46:18 +0100 Subject: [PATCH] fixes: PropertySetterInstance --- src/Avalonia.Styling/Styling/PropertySetterInstance.cs | 6 +++--- src/Avalonia.Styling/Styling/Setter.cs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Avalonia.Styling/Styling/PropertySetterInstance.cs b/src/Avalonia.Styling/Styling/PropertySetterInstance.cs index 1c3055fed6..bb0e342df6 100644 --- a/src/Avalonia.Styling/Styling/PropertySetterInstance.cs +++ b/src/Avalonia.Styling/Styling/PropertySetterInstance.cs @@ -16,14 +16,14 @@ namespace Avalonia.Styling private readonly IStyleable _target; private readonly StyledPropertyBase? _styledProperty; private readonly DirectPropertyBase? _directProperty; - private readonly T _value; + private readonly T? _value; private IDisposable? _subscription; private bool _isActive; public PropertySetterInstance( IStyleable target, StyledPropertyBase property, - T value) + T? value) { _target = target; _styledProperty = property; @@ -57,7 +57,7 @@ namespace Avalonia.Styling { if (_styledProperty is object) { - _subscription = _target.SetValue(_styledProperty, _value, BindingPriority.Style); + _subscription = _target.SetValue(_styledProperty!, _value, BindingPriority.Style); } else { diff --git a/src/Avalonia.Styling/Styling/Setter.cs b/src/Avalonia.Styling/Styling/Setter.cs index 168a882499..4c94ea02dd 100644 --- a/src/Avalonia.Styling/Styling/Setter.cs +++ b/src/Avalonia.Styling/Styling/Setter.cs @@ -101,7 +101,7 @@ namespace Avalonia.Styling data.result = new PropertySetterInstance( data.target, property, - (T)data.value!); + (T?)data.value); } }