/// <summary> /// Updates the legends. /// </summary> private void Update() { if (_itemsPanel == null) { return; } _itemsPanel.Children.Clear(); if (_chartElements == null || _chartElements.Count <= 0) { return; } // Populate panel with legend items. foreach (var chartElement in _chartElements) { var legendItem = new LegendItem(); legendItem.Symbol = chartElement.GetLegendSymbol(); legendItem.SetBinding(LegendItem.LabelProperty, new Binding("Title") { Source = chartElement }); legendItem.SetBinding(StyleProperty, new Binding("LegendItemStyle") { Source = this }); legendItem.SetBinding(VisibilityProperty, new Binding("IsVisibleInLegend") { Source = chartElement, Converter = BooleanToVisibilityConverter }); _itemsPanel.Children.Add(legendItem); } }
/// <summary> /// Updates the pie chart legend. /// </summary> private void Update() { if (_itemsPanel == null) { return; } _itemsPanel.Children.Clear(); if (_pieChart != null) { foreach (var symbol in _pieChart.GetPieChartLegendSymbols()) { var legendItem = new LegendItem(); legendItem.DataContext = symbol.DataContext; legendItem.Symbol = symbol; legendItem.Label = symbol.DataContext; legendItem.SetBinding(StyleProperty, new Binding("LegendItemStyle") { Source = this }); _itemsPanel.Children.Add(legendItem); } } }
/// <summary> /// Updates the legends. /// </summary> private void Update() { if (_itemsPanel == null) return; _itemsPanel.Children.Clear(); if (_chartElements == null || _chartElements.Count <= 0) return; // Populate panel with legend items. foreach (var chartElement in _chartElements) { var legendItem = new LegendItem(); legendItem.Symbol = chartElement.GetLegendSymbol(); legendItem.SetBinding(LegendItem.LabelProperty, new Binding("Title") { Source = chartElement }); legendItem.SetBinding(StyleProperty, new Binding("LegendItemStyle") { Source = this }); legendItem.SetBinding(VisibilityProperty, new Binding("IsVisibleInLegend") { Source = chartElement, Converter = BooleanToVisibilityConverter }); _itemsPanel.Children.Add(legendItem); } }
/// <summary> /// Updates the pie chart legend. /// </summary> private void Update() { if (_itemsPanel == null) return; _itemsPanel.Children.Clear(); if (_pieChart != null) { foreach (var symbol in _pieChart.GetPieChartLegendSymbols()) { var legendItem = new LegendItem(); legendItem.DataContext = symbol.DataContext; legendItem.Symbol = symbol; legendItem.Label = symbol.DataContext; legendItem.SetBinding(StyleProperty, new Binding("LegendItemStyle") { Source = this }); _itemsPanel.Children.Add(legendItem); } } }