Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

How to: Create a Map Item Attribute and Show its Value in the Map Tooltip

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