Skip to main content

MapItem.ToolTipPattern Property

Gets or sets a string which represents the pattern specifying the text to be displayed within a tooltip that appears for a map item.

Namespace: DevExpress.Xpf.Map

Assembly: DevExpress.Xpf.Map.v24.1.dll

NuGet Package: DevExpress.Wpf.Map

Declaration

[NonCategorized]
public string ToolTipPattern { get; set; }

Property Value

Type Description
String

A string value that is the tooltip pattern.

Remarks

The pattern string can contain placeholders that the Map Control replaces with specific values when generates the text for a map item. The tooltip pattern supports the following groups of placeholders:

Attribute Placeholders

These placeholders define values of map item attributes and enclosed with braces (“{“, “}”). For example the “{NAME}: ${GDP_MD_EST:#,0}M” pattern utilizes two placeholders. The first placeholder is for the NAME attribute and the second placeholder is for the GDP_MD_EST attribute. Note that the second placeholder uses the #,0 format string that goes after the “:” symbol.

Map Chart Value Placeholders

The Map Control uses this placeholder group to display map bubbles’ and map pies’ arguments and values in the tooltip. The “%” symbol encloses these placeholders. The following table lists available placeholders:

Placeholder

Placeholder’s meaning for Map Bubbles

Placeholder’s meaning for Map Pies

A

A map bubble’s argument.

Data objects’ PieItemDataMember field value when the Pie Chart Data adapter generates map pies.

V

A map bubble’s value.

A map pie’s total value.

A<index>

Is not supported.

An argument of a map pie segment with the specified index.

V<index>

Is not supported.

A value of a map pie segment with the specified index.

For example, the “%A0%: %V0%\r\n%A1%: %V1%\r\n%A2%: %V2%” pattern generates the text that displays the first three segments’ arguments and values.

The chart value attributes with indices are useful when the number of segments within map pies is known. You can utilize the VectorLayerBase.ToolTipContentTemplate property to manage the tooltip’s content when map pies have an unknown number of segments.

Example

This example demonstrates how to show an area value for the triangle item in the map tooltip using the map item’s attribute.

To accomplish this task, do the following:

To enable the map tooltip, set the MapControl.ToolTipEnabled property to true.

<Window
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:sys="clr-namespace:System;assembly=mscorlib"
        xmlns:dxm="http://schemas.devexpress.com/winfx/2008/xaml/map" 
        x:Class="UseMapItemAttribute.MainWindow"
        xmlns:core="clr-namespace:System;assembly=mscorlib"
        Title="MainWindow" Height="350" Width="525">

    <Grid>
        <dxm:MapControl ToolTipEnabled="True" >
            <!--region #AttributeInTooltip-->
            <dxm:VectorLayer Name="itemsLayer">
                <dxm:MapItemStorage>
                    <dxm:MapPolygon  
                        ToolTipPattern="{}Triangle Area: {areaValueAttrName}" 
                        Points="0,0,0,40,40,0,0,0">
                        <dxm:MapPolygon.Attributes>
                            <dxm:MapItemAttribute Name="areaValueAttrName" 
                                                  Type="{x:Type sys:Double}" 
                                                  Value="80" />
                        </dxm:MapPolygon.Attributes>
                    </dxm:MapPolygon>
                </dxm:MapItemStorage>
            </dxm:VectorLayer>
            <!--endregion #AttributeInTooltip-->
        </dxm:MapControl>
    </Grid>
</Window>
See Also