Version

Set Custom Format String

You can provide a custom format string to control the way data is displayed in xamMap™. MapElement properties such as Caption and ToolTip allow the use of standard .NET format strings. Other displayed values can also be customized; Color Swatch Pane labels can be customized by setting the LabelFormatString property to any standard format.

The following code shows you how to display the tooltip as a number with zero decimal places.

In XAML:

<igMap:MapLayer x:Name="worldLayer" DataMapping="Name=CountryName; Value=BirthRate" ToolTip="{} Birth Rate: {Value:n0}">
</igMap:MapLayer>

In Visual Basic:

' Set ToolTip format
For Each element As MapElement In layer.Elements
        element.ToolTip = String.Format("Birth Rate: {0:n0}", element.Value)
Next

In C#:

foreach (MapElement element in layer.Elements)
{
   element.ToolTip = string.Format("Birth Rate: {0:n0}", element.Value);
}
SL DV XamMap Set Custom Format String 01.png