Skip to main content
A newer version of this page is available. .

VectorLayerBase.ToolTipPattern Property

Gets or sets a string which represents the pattern specifying the text to be displayed within a tooltip.

Namespace: DevExpress.Xpf.Map

Assembly: DevExpress.Xpf.Map.v18.2.dll

Declaration

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

Property Value

Type Description
String

A System.String, which represents the tooltip pattern.

Remarks

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’ 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 illustrates how to display tooltips for shapes loaded from Shapefiles (Countries.dbf, Countries.shp).

Note that a tooltip displays information (a country name, population) for each map shape from Shapefiles.

To see information (a country name, population) obtained from a Shapefile on a toolltip, specify NAME and POP_EST attributes in the VectorLayerBase.ToolTipPattern property.

Then, enable map tooltips by setting the MapControl.ToolTipEnabled property to true.

<Window x:Class="ShowToolTips.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:dxm="http://schemas.devexpress.com/winfx/2008/xaml/map"
        xmlns:local="clr-namespace:ShowToolTips"
        Title="MainWindow" Height="350" Width="525">
    <Window.Resources>
        <local:MapItemPopulationAttributeToStringTypeConverter x:Key="mapItemPopulationAttributeConverter"/>
        <local:MapItemGdpAttributeToStringTypeConverter x:Key="mapItemGdpAttributeConverter"/>
        <DataTemplate x:Key="tooltipContentTemplate">
            <StackPanel Orientation="Vertical" Margin="8">
                <TextBlock Text="{Binding ToolTipText}"
                           Foreground="White" FontSize="24"/>
                <TextBlock Text="{Binding Item, Converter={StaticResource mapItemGdpAttributeConverter}, StringFormat=GDP: {0:C0}M}"
                           Foreground="Gray" FontSize="12"/>
                <TextBlock Text="{Binding Item, Converter={StaticResource mapItemPopulationAttributeConverter}, StringFormat=Population: {0}}"
                           Foreground="Gray" FontSize="12"/>
            </StackPanel>
        </DataTemplate>
    </Window.Resources>

    <Grid>
        <dxm:MapControl ToolTipEnabled="True">
            <dxm:VectorLayer  ToolTipPattern="{}{NAME}" 
                              ToolTipContentTemplate="{Binding Source={StaticResource tooltipContentTemplate}}">
                <dxm:ShapefileDataAdapter FileUri="/ShowToolTips;component/Data/Shapefiles/Countries.shp"/>
            </dxm:VectorLayer>
        </dxm:MapControl>
    </Grid>
</Window>

The following code snippets (auto-collected from DevExpress Examples) contain references to the ToolTipPattern property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also