我的图钉以如下常见方式添加到地图中:
C#:
private readonly ObservableCollection<PushpinModel> _pushpins = new observableCollection<PushpinModel>();
public ObservableCollection<PushpinModel> Pushpins
{
get{return _pushpins;}
}
XAML:
<my:MapItemsControl ItemsSource="{Binding Pushpins}">
<my:MapItemsControl.ItemTemplate>
<DataTemplate>
<my:Pushpin Style="{StaticResource PushpinStyle}"
MouseLeftButtonUp="Pushpin_MouseLeftButtonUp"
Location="{Binding Location}"
Content="{Binding Num}">
</my:Pushpin>
</DataTemplate>
</my:MapItemsControl.ItemTemplate>
</my:MapItemsControl>
单击图钉时,我可以将图钉作为发件人并获取位置信息。但我想追踪它的PushpinModel
对象以获取与 相关的其他信息Pushpin
,如名称、描述、url 等。我该怎么做?