internal virtual LegendItem GetLegendItem() { if (string.IsNullOrWhiteSpace(this.Series.LegendText)) { return((LegendItem)null); } LegendItem legendItem1 = new LegendItem(); legendItem1.Label = (object)this.Series.LegendText; legendItem1.SymbolContent = (object)this.GetLegendSymbol(); legendItem1.DataContext = (object)this.Series; LegendItem legendItem2 = legendItem1; legendItem2.SetBinding(LegendItem.IsSelectedProperty, (BindingBase) new Binding("IsLegendSelected") { Source = (object)this.Series }); legendItem2.SetBinding(LegendItem.UnselectedOpacityProperty, (BindingBase) new Binding("UnselectedDataPointOpacity") { Source = (object)this.Series }); legendItem2.SetBinding(LegendItem.UnselectedEffectProperty, (BindingBase) new Binding("UnselectedDataPointEffect") { Source = (object)this.Series }); return(legendItem2); }
public static void SetCommonBindings(LegendItem legendItem, object chart) { legendItem.DataContext = chart; legendItem.SetBinding(Legend.VisualContentProperty, new Binding { Path = new PropertyPath("(0)", Legend.VisualContentProperty) }); legendItem.SetBinding(Legend.DescriptionProperty, new Binding { Path = new PropertyPath("(0)", Legend.DescriptionProperty) }); }