MapPushpinSettings.MarkerTemplate Property
Gets or sets the data template used to specify the marker appearance of map pushpins generated using these settings. This is a dependency property.
Namespace: DevExpress.Xpf.Map
Assembly: DevExpress.Xpf.Map.v24.2.dll
NuGet Package: DevExpress.Wpf.Map
Declaration
Property Value
Type | Description |
---|---|
DataTemplate | A DataTemplate object that defines the element presentation. |
Property Paths
You can access this nested property as listed below:
Object Type | Path to MarkerTemplate |
---|---|
MapPushpinSettings |
|
Example
This example demonstrates how to customize the appearance of automatically generated map pushpins.
To do this, customize one or all of the following properties of the MapPushpinSettings object assigned to the ListSourceDataAdapter.ItemSettings property.
MapPushpinSettings.MarkerTemplate
- allows specifying the MapPushpin.MarkerTemplate property value used by automatically generated MapPushpin objects.- MapPushpinSettings.Template - allows specifying the MapPushpin.Template property value used by automatically generated MapPushpin objects.
<Window x:Class="MapPushpinSettings_Example.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"
Title="MainWindow" MinHeight="350" MinWidth="525">
<Window.Resources>
<XmlDataProvider x:Key="dataSet" Source="Data/Ships.xml" XPath="/Ships"/>
<ControlTemplate x:Key="pushpinTemplate">
<dxm:PushpinControl ItemInfo="{Binding}"
Visibility="Visible"/>
</ControlTemplate>
<DataTemplate x:Key="markerTemplate">
<Grid HorizontalAlignment="Center" Height="64" VerticalAlignment="Center" Width="64">
<Grid.RenderTransform>
<TransformGroup>
<TranslateTransform X="-32" Y="-52"/>
<RotateTransform x:Name="PointerRotation" Angle="0"/>
</TransformGroup>
</Grid.RenderTransform>
<Grid Height="44" Width="36">
<Path x:Name="Edge" Stretch="Fill" Fill="White" Margin="0,0,0,-0.001" UseLayoutRounding="False"
Data="M18,0 C27.9411,0 36,8.05908 36,18.0004 C36,22.8353 34.0938,27.2251 30.992,30.459 L18.3825,44.001 L17.6179,44.001 L5.2447,30.7012 C2.0034,27.4459 0,22.9571 0,18.0004 C0,8.05908 8.0589,0 18,0 z"/>
<Path Stretch="Fill" Fill="{Binding MapItem.Brush}" Margin="0.999" UseLayoutRounding="False"
Data="M17.001,0 C26.3904,0 34.002,7.61156 34.002,17.0008 C34.002,21.196 32.4824,25.0363 29.9638,28.0013 L17.001,42.002 L4.03824,28.0013 C1.51949,25.0363 0,21.196 0,17.0008 C0,7.61156 7.61155,0 17.001,0 z M17.001,7.00101 C22.5238,7.00101 27.001,11.4784 27.001,17.0015 C27.001,22.5247 22.5238,27.002 17.001,27.002 C11.4781,27.002 7.00098,22.5247 7.00098,17.0015 C7.00098,11.4784 11.4781,7.00101 17.001,7.00101 z"/>
<TextBlock x:Name="Label" TextWrapping="Wrap" Text="{Binding MapItem.Text}"
Foreground="{Binding MapItem.TextBrush}"
HorizontalAlignment="Center" VerticalAlignment="Center"
FontWeight="Bold" Margin="0,0,0,7" FontSize="13.333" Opacity="0.75"/>
</Grid>
</Grid>
</DataTemplate>
</Window.Resources>
<Grid>
<dxm:MapControl CenterPoint="-30,140" ZoomLevel="4">
<dxm:ImageTilesLayer>
<dxm:BingMapDataProvider BingKey="Your Bing Key"/>
</dxm:ImageTilesLayer>
<dxm:VectorLayer>
<dxm:ListSourceDataAdapter DataSource="{Binding Source={StaticResource dataSet}, XPath=Ship}">
<dxm:ListSourceDataAdapter.Mappings>
<dxm:MapItemMappingInfo Latitude="Latitude" Longitude="Longitude"/>
</dxm:ListSourceDataAdapter.Mappings>
<dxm:ListSourceDataAdapter.ItemSettings>
<dxm:MapPushpinSettings Template="{StaticResource pushpinTemplate}"
MarkerTemplate="{StaticResource markerTemplate}"
Brush="#FF5F5F5F"/>
</dxm:ListSourceDataAdapter.ItemSettings>
</dxm:ListSourceDataAdapter>
</dxm:VectorLayer>
</dxm:MapControl>
</Grid>
</Window>
See Also