Skip to main content

MapPushpin.Template Property

Gets or sets the template that allows completely specifying the appearance and behavior of a map pushpin. This is dependency property.

Namespace: DevExpress.Xpf.Map

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

NuGet Package: DevExpress.Wpf.Map

Declaration

public ControlTemplate Template { get; set; }

Property Value

Type Description
ControlTemplate

A ControlTemplate object that represents the template that displays a map pushpin.

Example

This example demonstrates how to customize the map pushpin’s appearance and behavior.

To do this, the MapPushpin.Template and the MapPushpin.MarkerTemplate properties are used.

<Window
        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" x:Class="MapPushpinTemplate.MainWindow"
        Title="MainWindow" Height="350" Width="525">
    <Window.Resources>
        <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>
            <dxm:VectorLayer>
                <dxm:MapItemStorage>
                    <dxm:MapPushpin Template="{StaticResource pushpinTemplate}"
                                    MarkerTemplate="{StaticResource markerTemplate}"
                                    Brush="#FF5E6E6E"/>
                </dxm:MapItemStorage>
            </dxm:VectorLayer>
        </dxm:MapControl>

    </Grid>
</Window>
See Also