From 18caac12caa1c49f32c20bd298d0b1f34f153194 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Tue, 19 Jul 2022 17:32:05 +0200 Subject: [PATCH] Don't start values unnecessarily. --- src/Avalonia.Base/PropertyStore/ValueStore.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Avalonia.Base/PropertyStore/ValueStore.cs b/src/Avalonia.Base/PropertyStore/ValueStore.cs index b5db37ca20..2b194ffbe6 100644 --- a/src/Avalonia.Base/PropertyStore/ValueStore.cs +++ b/src/Avalonia.Base/PropertyStore/ValueStore.cs @@ -823,20 +823,20 @@ namespace Avalonia.PropertyStore for (var j = 0; j < count; ++j) { var entry = frame.GetEntry(j); + var property = entry.Property; + EffectiveValue? effectiveValue = null; - if (!entry.HasValue) + // Skip if we already have a value/base value for this property. + if (_effectiveValues?.TryGetValue(property, out effectiveValue) == true && + effectiveValue.BasePriority < BindingPriority.Unset) continue; - var property = entry.Property; + if (!entry.HasValue) + continue; - if (_effectiveValues is not null && - _effectiveValues.TryGetValue(property, out var effectiveValue)) + if (effectiveValue is not null) { - if (effectiveValue.Priority == BindingPriority.Unset || - effectiveValue.BasePriority == BindingPriority.Unset) - { - effectiveValue.SetAndRaise(this, entry, priority); - } + effectiveValue.SetAndRaise(this, entry, priority); } else {