Browse Source

Re-evaluate all properties if necessary.

Even if the frame's activation state has changed to false.
pull/8600/head
Steven Kirk 4 years ago
parent
commit
2144f920be
  1. 5
      src/Avalonia.Base/PropertyStore/ValueFrame.cs
  2. 36
      src/Avalonia.Base/PropertyStore/ValueStore.cs

5
src/Avalonia.Base/PropertyStore/ValueFrame.cs

@ -37,9 +37,8 @@ namespace Avalonia.PropertyStore
[NotNullWhen(true)] out IValueEntry? entry,
out bool activeChanged)
{
if (_index.TryGetValue(property, out entry) &&
GetIsActive(out activeChanged))
return true;
if (_index.TryGetValue(property, out entry))
return GetIsActive(out activeChanged);
activeChanged = false;
return false;
}

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

@ -787,30 +787,28 @@ namespace Avalonia.PropertyStore
{
var frame = _frames[i];
var priority = frame.Priority;
var foundEntry = frame.TryGetEntryIfActive(property, out var entry, out var activeChanged);
// If the active state of the frame has changed since the last read, and
// the frame holds multiple values then we need to re-evaluate the
// effective values of all properties.
if (activeChanged && frame.EntryCount > 1)
{
ReevaluateEffectiveValues();
return;
}
if (frame.TryGetEntryIfActive(property, out var entry, out var activeChanged))
if (foundEntry && entry!.HasValue)
{
// If The active state of the frame has changed since the last read, and
// the frame holds multiple values then we need to re-evaluate the
// effective values of all properties.
if (activeChanged && frame.EntryCount > 1)
if (current is not null)
{
ReevaluateEffectiveValues();
return;
current.SetAndRaise(this, entry, priority);
}
if (entry.HasValue)
else
{
if (current is not null)
{
current.SetAndRaise(this, entry, priority);
}
else
{
current = property.CreateEffectiveValue(Owner);
AddEffectiveValue(property, current);
current.SetAndRaise(this, entry, priority);
}
current = property.CreateEffectiveValue(Owner);
AddEffectiveValue(property, current);
current.SetAndRaise(this, entry, priority);
}
}

Loading…
Cancel
Save