【发布时间】:2015-08-24 16:34:53
【问题描述】:
如何添加到我的地图控件自定义图钉? 我需要在我的别针中: 文本块和按钮
我尝试这样的事情:
<Maps:MapControl Grid.Row="2"
x:Name="MapControl"
MapServiceToken=""
Margin="0,0,0,0" >
<Maps:MapItemsControl >
<Maps:MapItemsControl.ItemTemplate>
<DataTemplate>
<Grid>
<TextBlock Height="25" Text="{Binding Where}" Maps:MapControl.Location="{Binding Location}" />
<Button Content="MyButton" Maps:MapControl.Location="{Binding Location}" />
</Grid>
</DataTemplate>
</Maps:MapItemsControl.ItemTemplate>
</Maps:MapItemsControl>
</Maps:MapControl>
但是如何将 DataSource 或 ItemsSource 添加到我的 MapItemsControl? 我需要在后面的代码中执行此操作。
我的模特:
public class PinModel
{
public Geopoint Location { get; set; }
public string Where { get; set; }
}
以及如何做这样的事情:
List<PinModel> pins = new List<PinModel>();
MapControl.DataSource = pins?????(how can I do this?)
然后在我的地图上找到图钉。
使用 Windows Phone 8.1
Maps:MapControl
xmlns:Maps="using:Windows.UI.Xaml.Controls.Maps"
【问题讨论】:
标签: c# windows-phone-8.1