/// <summary> /// Dequeues an UIElement from the specified renderer. /// </summary> /// <param name="renderer"> /// Specifies the corresponding renderer to dequeue the UIElement /// </param> /// <returns> /// Returns the UIelement. /// </returns> public T Dequeue(GridCellRendererBase renderer) { if (!ContainsKey(renderer)) { return(default(T)); } Queue <WeakReference> queue = base[renderer]; if (queue.Count == 0) { return(default(T)); } var el = queue.Dequeue().Target as T; if (el == null) { return(default(T)); } el.Visibility = Visibility.Visible; return(el); }
/// <summary> /// Gets the <see cref="System.Collections.Generic.Queue{WeakReference}"/> for the specified Renderer. /// </summary> /// <value></value> public new Queue <WeakReference> this[GridCellRendererBase renderer] { get { if (ContainsKey(renderer)) { return(base[renderer]); } Queue <WeakReference> queue = base[renderer] = new Queue <WeakReference>(); return(queue); } }
/// <summary> /// Cheks whether the Render Dictionary contains the corresponding renderer. /// </summary> /// <param name="cellRenderer"></param> /// <returns></returns> /// <remarks></remarks> public bool ContainsValue(GridCellRendererBase cellRenderer) { return(this.content.ContainsValue(cellRenderer)); }
/// <summary> /// Enqueues the UI element to the specified renderer. /// </summary> /// <param name="renderer"> /// The corresponding renderer to enqueue the UIElement in it. /// </param> /// <param name="uiElement"> /// The corresponding UIElement to perform enqueue operation. /// </param> public void Enqueue(GridCellRendererBase renderer, T uiElement) { this[renderer].Enqueue(new WeakReference(uiElement)); uiElement.Visibility = Visibility.Collapsed; }