MapItem.Attributes Property
Gets the attributes for this map item.
Namespace: DevExpress.Xpf.Map
Assembly: DevExpress.Xpf.Map.v22.2.dll
NuGet Package: DevExpress.Wpf.Map
Declaration
Property Value
Type | Description |
---|---|
MapItemAttributeCollection | A MapItemAttributeCollection object. |
Example
This example illustrates how to display tooltips for shapes loaded from Shapefiles (Countries.dbf, Countries.shp).
To customize the appearance of tooltips, you can use the following properties.
- VectorLayerBase.ToolTipPattern allows you to specify the pattern used to generate ToolTipInfo.ToolTipText.
- VectorLayerBase.ToolTipContentTemplate allows you to specify the content template used to display tooltip data.
<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>
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the Attributes 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.