Browse Source

Include inherited/default values in diagnostic.

pull/8600/head
Steven Kirk 4 years ago
parent
commit
bda4a4b964
  1. 24
      src/Avalonia.Base/PropertyStore/ValueStore.cs

24
src/Avalonia.Base/PropertyStore/ValueStore.cs

@ -619,11 +619,29 @@ namespace Avalonia.PropertyStore
public AvaloniaPropertyValue GetDiagnostic(AvaloniaProperty property) 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( return new AvaloniaPropertyValue(
property, property,
effective?.Value, value,
effective?.Priority ?? BindingPriority.Unset, priority,
null); null);
} }

Loading…
Cancel
Save