Click here to Skip to main content
15,903,203 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi.

I need add custum tooltip to my pie chart in code .

My (not working) code :
C#
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;


Colors work fine but tooltip is not working.

P.S.: do not post XAML code pls, its not solution for me. THX
Posted
Updated 23-Jan-12 22:14pm
v2
Comments
iamgun10a 27-Jan-12 2:23am    
No one ???

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900