private LegendItem RaiseResolveLegendItem(LegendItem uncustomizedLegendItem) { if (ResolveLegendItem != null) { ResolveLegendItemEventArgs e = new ResolveLegendItemEventArgs(uncustomizedLegendItem); ResolveLegendItem(this, e); return(e.LegendItem); } else { return(uncustomizedLegendItem); } }
private void graph_PropertyChanged(object sender, PropertyChangedEventArgs e) { if (e.PropertyName == "Description") { ViewportElement2D graph = (ViewportElement2D)sender; LegendItem oldLegendItem = cachedLegendItems[graph]; int index = stackPanel.Children.IndexOf(oldLegendItem); stackPanel.Children.RemoveAt(index); LegendItem newLegendItem = graph.Description.LegendItem; cachedLegendItems[graph] = newLegendItem; stackPanel.Children.Insert(index, newLegendItem); } }
public void PopulateLegend() { stackPanel.Children.Clear(); if (plotter == null) { return; } cachedLegendItems.Clear(); foreach (var graph in plotter.Children.OfType <ViewportElement2D>()) { if (GetVisibleInLegend(graph)) { LegendItem legendItem = graph.Description.LegendItem; cachedLegendItems.Add(graph, legendItem); AddLegendItem(legendItem); } } UpdateVisibility(); }
public ResolveLegendItemEventArgs(LegendItem legendItem) { LegendItem = legendItem; }
private LegendItem CreateLegendItem() { LegendItem item = CreateLegendItemCore(); return(RaiseResolveLegendItem(item)); }
/// <summary> /// Removes the legend item. /// </summary> /// <param name="legendItem">The legend item.</param> public void RemoveLegendItem(LegendItem legendItem) { stackPanel.Children.Remove(legendItem); UpdateVisibility(); }
/// <summary> /// Adds new legend item. /// </summary> /// <param name="legendItem">The legend item.</param> public void AddLegendItem(LegendItem legendItem) { stackPanel.Children.Add(legendItem); UpdateVisibility(); }