我为XAML创建了图钉(图像和一些文本)的模板。但是,我不知道如何在我的C#代码中使用它。
这是我的temlate:
<maps:Map x:Name="myMap" Width="446" Loaded="myMap_Loaded">
<maps:Map.Layers>
<maps:MapLayer>
<maps:MapOverlay>
<toolkit:Pushpin x:Name="myPushpin">
<toolkit:Pushpin.Template>
<ControlTemplate TargetType="toolkit:Pushpin">
<Grid Background="WhiteSmoke">
<Grid.RowDefinitions>
<RowDefinition Height="40"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40"/>
<ColumnDefinition Width="300"/>
</Grid.ColumnDefinitions>
<Image x:Name="pushpinImg" Grid.Row="0" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center" Height="30" Width="30"/>
<TextBlock x:Name="pushpinText" Grid.Row="0" HorizontalAlignment="Left" Grid.Column="1" Foreground="Green" TextWrapping="Wrap"/>
</Grid>
</ControlTemplate>
</toolkit:Pushpin.Template>
</toolkit:Pushpin>
</maps:MapOverlay>
</maps:MapLayer>
</maps:Map.Layers>
</maps:Map>