How can I format the tooltip text to be in the currency format?
I have a project where I followed along with http://blogs.msdn.co...ls-for-wpf.aspx to build my project.
Right now my code is:
<Window x:Class="LearningChart.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:toolkit="http://schemas.microsoft.com/wpf/2008/toolkit"
xmlns:charting="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit"
Title="Window1" Height="314" Width="542">
<Grid>
<charting:Chart x:Name="chart" Width="350" Height="250">
<charting:Chart.Series>
<charting:PieSeries ItemsSource="{Binding}"
DependentValuePath="Value"
IndependentValuePath="Key"
Title="Pet Preference" IsSelectionEnabled="True" />
</charting:Chart.Series>
</charting:Chart>
</Grid>
</Window>
I lob this into the project and make it run as the window initializes:
chart.DataContext = new KeyValuePair<string, int>[] {
new KeyValuePair<string, int>("Dog", 30),
new KeyValuePair<string, int>("Cat", 25),
new KeyValuePair<string, int>("Rat", 5),
new KeyValuePair<string, int>("Hampster", 8),
new KeyValuePair<string, int>("Rabbit", 12) };
As you will notice at runtime, when you mouse over one of the pie slices, you will be shown (in tool-tip) the absolute value and the percentage. How can I make it say "Hello World:" + absoluteValue? And/Or how can I make it print the absolute value as a currency with a $ sign and commas?

New Topic/Question
Reply




MultiQuote




|