private void InternalRenderComplete(object sender, EventArgs e) { this.DynamicRendererThreadManager.MainMediaContextRenderComplete -= this._mainRenderComplete; List <DryingDrawingVisual> dryingDrawingVisualList = this._dryingDrawingVisualList; bool flag = false; List <DryingDrawingVisual> source; try { Monitor.Enter(dryingDrawingVisualList, ref flag); source = this._dryingDrawingVisualList.ToList <DryingDrawingVisual>(); this._dryingDrawingVisualList.Clear(); } finally { Monitor.Exit(dryingDrawingVisualList); } var group = (from temp in source group temp by temp.ContainerVisual); foreach (var dryingDrawingVisual in group) { ContainerVisual containerVisual = dryingDrawingVisual.Key; if (!containerVisual.CheckAccess()) { containerVisual.Dispatcher.InvokeAsync(delegate() { TestLable.RemoveDrawingVisual(dryingDrawingVisual, containerVisual); }, DispatcherPriority.Background); continue; } TestLable.RemoveDrawingVisual(dryingDrawingVisual, containerVisual); } }