diff --git a/src/Avalonia.Base/PropertyStore/ValueStore.cs b/src/Avalonia.Base/PropertyStore/ValueStore.cs index eb97009355..9b80002a33 100644 --- a/src/Avalonia.Base/PropertyStore/ValueStore.cs +++ b/src/Avalonia.Base/PropertyStore/ValueStore.cs @@ -619,11 +619,29 @@ namespace Avalonia.PropertyStore public AvaloniaPropertyValue GetDiagnostic(AvaloniaProperty property) { - var effective = GetEffectiveValue(property); + object? value; + BindingPriority priority; + + if (_effectiveValues.TryGetValue(property, out var v)) + { + value = v.Value; + priority = v.Priority; + } + else if (property.Inherits && TryGetInheritedValue(property, out v)) + { + value = v.Value; + priority = BindingPriority.Inherited; + } + else + { + value = GetDefaultValue(property); + priority = BindingPriority.Unset; + } + return new AvaloniaPropertyValue( property, - effective?.Value, - effective?.Priority ?? BindingPriority.Unset, + value, + priority, null); }