I like the behavior of the default tooltips on the XamDataChart but in some cases I would like to format the number as say currency. I've looked into creating a custom tooltip to handle this but am running into constant grief due to the way our charts are being built dynamically. I did notice that there is a property on the Series called ToolTipFormatter which looks like it should handle this simple requirement but I can't figure out how to use it, especially in code behind where most of our code is done. Can you please provide an example of how to use it? Thanks!
It doesn't look like this property is meant to be used. In all the samples I've seen, this property is always null and it's read-only so I can't set it to anything. In order to set a currency format this will have to be done in a custom tooltip that binds to the data point value and applies the format there. A binding using StringFormat should work nicely.
Looks like it would a be a good property to have implemented though to save custom templating for such a common requirement? Since I like the default layout, I believe I'd need to replicate the existing template and tweak it with the binding you suggest. Can you please advise how I'd get the XAML for the default template to copy/paste then modify? Thanks!
You can actually find the template here. There is a style in this doc called "ToolTipStyle" and the template for this style contains the elements required to reproduce the tooltip. There are two ContentPresenters. One has its ContentTemplate property bound to the Series.LegendItemBadgeTemplate and the other presenter is where the Series.ToolTip content goes.
Let me know if you have any further questions on this matter.