ResourceDictionaryCollection palette = new ResourceDictionaryCollection(); for (int i = 0; i < pieChart.Colors; i++) { Style style = new Style(typeof(Control)); style.Setters.Add(new Setter(BackgroundProperty,GetColorFromHexa(pieChart.Colors[i]))); ResourceDictionary dictionary = new ResourceDictionary(); Style styleTT = new Style(typeof(ToolTip)); styleTT.Setters.Add(new Setter(ContentControl.ContentProperty, "Custom ToolTip")); styleTT.Setters.Add(new Setter(ContentControl.ContentProperty,"{TemplateBinding FormattedDependentValue}")); styleTT.Setters.Add(new Setter(ContentControl.ContentProperty,"{TemplateBinding FormattedRatio}")); styleTT.Setters.Add(new Setter(ContentControl.ContentProperty, "{Binding Key}")); ToolTip tt = new ToolTip(); tt.Style = styleTT; style.Setters.Add(new Setter(ToolTipService.ToolTipProperty,tt)); dictionary.Add("DataPointStyle", style); palette.Add(dictionary); } ((PieSeries)graf.Series[0]).Palette = palette;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)