2011-03-21 52 views
2

Howdy, 我想在地图上的单独图层上生成多个图钉位置。这些图钉应代表这个坐标的位置。因此,他们应该显示一些额外的信息,一旦用户点击/触摸图钉,应该可见。PushPin中的自定义模板

整个解决方案完全基于代码(添加了图钉)。

我已经在这里上具有sa,我应该把一个看不见的按钮图钉背后 - 但我不能肯定我应该怎么做。

如果有人有提示,这将是伟大的,会带我前进!

由于

<DataTemplate x:Key="PushpinControlTemplate2"> 
    <Grid x:Name="ContentGrid"> 
     <StackPanel Orientation="Vertical"> 

      <Grid Background="{TemplateBinding Background}" 
             HorizontalAlignment="Left" 
             MinHeight="10" 
             MinWidth="29"> 
       <Hyperlinkbutton HorizontalAlignment="Center" Content="{binding}" Click="clicker" Margin="0"/> 
      </Grid> 

      <Polygon Fill="{TemplateBinding Background}" 
           Points="0,0 29,0 0,29" 
           Width="29"        
           Height="29" 
           HorizontalAlignment="Left"/> 
     </StackPanel> 
    </Grid> 
</DataTemplate> 

这是我的代码,我使用至今,函数答题被定义,但是我总是错误 'AG_E_PARSER_BAD_PROPERTY_VALUE [行:5位置:98]'

回答

6

Pushpin-Styles in Bing Maps for the Windows Phone帖子应该告诉你一切你需要知道的样式图钉。

+0

剩下的问题是我如何能在C#代码“的ContentTemplate”属性设置为相应的DataTemplate – theXs 2011-03-21 16:13:58

+2

将它设置为资源,然后从那里加载,例如'myPushPin.ContentTemplate =(ContentTemplate)Application.Current.Resources [“TemplateKey”];或从XAML反序列化它,例如'myPushPin.ContentTemplate =(ContentTemplate)XamlLoader.Load(templateString);' – 2011-03-21 17:15:46

+0

我用更多的牛肉更新了我的第一篇文章。 – theXs 2011-03-23 16:22:57