在windows phone中的谷歌地图中自定义图钉
本文关键字:自定义 谷歌地图 windows phone | 更新日期: 2023-09-27 18:22:48
我试着为windows手机谷歌地图制作自己的图钉。它可以在xaml中绘制椭圆、矩形或文本块,但当我试图使图钉成为图像时,我什么也看不到。
我的主要代码:
<m:MapItemsControl x:Name="Pushpins" ItemsSource="{Binding Pushpins}" >
<m:MapItemsControl.ItemTemplate>
<DataTemplate>
<m:Pushpin Name="Pin"
Template="{StaticResource PushpinTemplate}"
Location="{Binding Position}" />
</DataTemplate>
</m:MapItemsControl.ItemTemplate>
</m:MapItemsControl>
我的资源文件:
<ControlTemplate x:Key="PushpinTemplate" TargetType="m:Pushpin">
<Grid Height="24" Width="24" Margin="0">
<TextBlock Text="Hej"/>
<Image Source="/Icons/Bird_PushPin.png" Stretch="Fill"/>
</Grid>
</ControlTemplate>
为什么不起作用:/?
找到了答案。
代码没有错,但在VS2010项目中,我不得不将图像的构建操作设置为"内容"而不是"资源"。。。