This repository has been archived by the owner on Oct 24, 2023. It is now read-only.
/
MainWindow.xaml
30 lines (29 loc) · 1.69 KB
/
MainWindow.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<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>