public void PopulateLegend() { legendItems.Clear(); if (!LegendVisible) { return; } foreach (var chart in plotter.Children.OfType <DependencyObject>()) { var legendItemsBuilder = NewLegend.GetLegendItemsBuilder(chart); if (legendItemsBuilder != null) { foreach (var legendItem in legendItemsBuilder((IPlotterElement)chart)) { legendItems.Add(legendItem); } } //var controller = LegendItemControllersStore.Current.GetController(chart.GetType()); //if (controller != null) //{ // controller.ProcessChart(chart, this); //} } UpdateVisibility(); }
private static void OnLegendVisibleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { NewLegend owner = (NewLegend)d; var visible = (bool)e.NewValue; owner.OnLegendVisibleChanged(visible); }
private static void OnPlotterChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { NewLegend legend = (NewLegend)d; if (e.OldValue != null) { legend.DetachFromPlotter((Plotter)e.OldValue); } if (e.NewValue != null) { legend.AttachToPlotter((Plotter)e.NewValue); } }
private static void OnShowInLegendChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { NewLegend legend = (NewLegend)d; legend.PopulateLegend(); }