【问题标题】:Custom pushpin in google maps in windows phoneWindows Phone 中谷歌地图中的自定义图钉
【发布时间】:2012-02-07 14:37:25
【问题描述】:

我尝试为 windows phone google maps 制作自己的图钉。它可以在 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>

为什么这不起作用:/?

【问题讨论】:

    标签: c# .net windows-phone-7 xaml


    【解决方案1】:

    找到答案了。

    代码没有问题,但在 VS2010 项目中,我不得不将图像的 Build Action 设置为“Content”而不是“Resource”...

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-04-26
      • 1970-01-01
      • 2017-01-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-10-31
      相关资源
      最近更新 更多