in src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions/Core/IncrementalUpdateBehavior.cs [378:418]
public void UncachePhaseElement(FrameworkElement phaseElement, int phase)
{
if (phase <= 0)
{
return;
}
UIElement contentTemplateRoot = IncrementalUpdater.FindContentTemplateRoot(phaseElement);
if (contentTemplateRoot != null)
{
// get the cache for this element
ElementCacheRecord elementCacheRecord;
if (this._elementCache.TryGetValue(contentTemplateRoot, out elementCacheRecord))
{
// get the cache for this phase
int phaseIndex = elementCacheRecord.Phases.BinarySearch(phase);
if (phaseIndex >= 0)
{
// remove the element: the linear search here is not spectacular but the list should be very short
List<PhasedElementRecord> phasedElementRecords = elementCacheRecord.ElementsByPhase[phaseIndex];
for (int i = 0; i < phasedElementRecords.Count; i++)
{
if (phasedElementRecords[i].FrameworkElement == phaseElement)
{
phasedElementRecords[i].ThawAndShow();
phasedElementRecords.RemoveAt(i);
if (phasedElementRecords.Count == 0)
{
elementCacheRecord.Phases.RemoveAt(phaseIndex);
elementCacheRecord.ElementsByPhase.RemoveAt(phaseIndex);
}
}
}
}
}
}
}