Hi,
I have a xamMap being bound to a collection of data items for say States. The data only contains data for half the states. What options are there for displaying the caption/tooltip so that if you include the Value or a numeric piece of data that when the data is not present for a particular state it doesn't display NaN i.e.
ToolTip="{}{Name} ({Value})"
This displays as Alaska (NaN)
Thanks,
Chris
Just what I needed, thanx Ivan!
Hi Chris,
One way to achieve this is to attach to MapLayer's Imported event and set MapElements' ToolTip explicitly, like in the following code snippet:
private void MapLayer_Imported(object sender, MapLayerImportEventArgs e){ if (e.Action == MapLayerImportAction.End) { var layer = (MapLayer) sender; foreach (var element in layer.Elements) { if (double.IsNaN(element.Value)) { element.ToolTip = element.Name; } else { element.ToolTip = string.Format("{0} ({1})", element.Name, element.Value); } } }}
Regards,
Ivan Kotev