/// <summary> /// Enqueues any elements within the specified tree that have invalid measure, arrange, or styles, but /// were previously removed from the queues as a result of being orphaned by a destroyed window. /// </summary> /// <param name="root">The root of the tree to restore.</param> internal void RestoreToQueues(DependencyObject root) { Contract.Require(root, nameof(root)); if (root is UIElement uiElement) { if (!uiElement.IsMeasureValid) { MeasureQueue.Enqueue(uiElement); } if (!uiElement.IsArrangeValid) { ArrangeQueue.Enqueue(uiElement); } if (!uiElement.IsStyleValid) { StyleQueue.Enqueue(uiElement); } } VisualTreeHelper.ForEachChild(root, this, (child, state) => { ((PresentationFoundation)state).RestoreToQueues(child); }); }
/// <summary> /// Removes all elements associated with the specified view from the Foundation's processing queues. /// </summary> /// <param name="view">The view to remove from the queues.</param> internal void RemoveFromQueues(PresentationFoundationView view) { Contract.Require(view, nameof(view)); StyleQueue.Remove(view); MeasureQueue.Remove(view); ArrangeQueue.Remove(view); }
/// <summary> /// Removes the specified UI element from all of the Foundation's processing queues. /// </summary> /// <param name="element">The element to remove from the queues.</param> internal void RemoveFromQueues(UIElement element) { Contract.Require(element, nameof(element)); StyleQueue.Remove(element); MeasureQueue.Remove(element); ArrangeQueue.Remove(element); }