void RemoveTitle(DesignerChartTitle title) { Chart uChart = this.Content as Chart; for (int i = 0; i < uChart.Titles.Count; i++) { if (uChart.Titles[i].Uid == title.ID.ToString()) { uChart.Titles.Remove(uChart.Titles[i]); } } }
void AddTitle(DesignerChartTitle newTitle) { Title t = new Title(); //t.DataContext = newTitle; t.Uid = newTitle.ID.ToString(); t.SetBinding(Title.BackgroundProperty, new Binding("TitleBackground") { Source = newTitle }); t.SetBinding(Title.BorderColorProperty, new Binding("TitleBorder.BorderBrush") { Source = newTitle }); t.SetBinding(Title.BorderThicknessProperty, new Binding("TitleBorder.BorderThickness") { Source = newTitle }); t.SetBinding(Title.CornerRadiusProperty, new Binding("TitleBorder.CornerRadius") { Source = newTitle }); t.SetBinding(Title.TextProperty, new Binding("Text") { Source = newTitle }); t.SetBinding(Title.FontColorProperty, new Binding("TitleFont.FontColor") { Source = newTitle }); t.SetBinding(Title.FontFamilyProperty, new Binding("TitleFont.FontFamily") { Source = newTitle }); t.SetBinding(Title.FontSizeProperty, new Binding("TitleFont.FontSize") { Source = newTitle }); t.SetBinding(Title.FontStyleProperty, new Binding("TitleFont.FontStyle") { Source = newTitle }); t.SetBinding(Title.FontWeightProperty, new Binding("TitleFont.FontWeight") { Source = newTitle }); Chart uChart = this.Content as Chart; if (uChart.Titles == null) { uChart.Titles = new TitleCollection(); } if (!uChart.Titles.Contains(t)) { uChart.Titles.Add(t); } }