我在我的Windows应用商店应用中使用 Bing地图,我会在其上显示一些带有一些位置的图钉。
我想要做的是当用户点击图钉时,弹出窗口显示一些与该图钉位置相关的信息。当用户点击我在Microsoft地图应用程序中的位置
时,类似于弹出窗口的内容如何做到这一点?
答案 0 :(得分:1)
非常简单,您可以使用图钉的Tapped
事件触发弹出窗口,然后使用MapLayer.SetPosition
定位弹出窗口,请参阅http://msdn.microsoft.com/en-us/library/hh846488.aspx
喜欢这个
currentLocationPushpin.Tapped += Current_location_pushpin_tapped;
然后
void Current_location_pushpin_tapped(object sender, TappedRoutedEventArgs e)
{
MapLayer.SetPosition(placesAroundYou,location);
MapLayer.SetPositionAnchor(placesAroundYou, new Point(-200, 40));
BingMap.Children.Add(_mapLayer);
}
尝试使用弹出控件或伪造这样的
您可以使用弹出窗口控件(请参阅MSDN documentation here)或切换边框元素的可见性来伪造弹出窗口使用Visibility="Collapsed"
,试试这个
<Border Background="#FFC3C2BF" Opacity="50" Margin="38,0,0,376" BorderThickness="1" BorderBrush="Black" CornerRadius="8" HorizontalAlignment="Left" MinWidth="50" Width="126" Height="auto">
<TextBlock x:Name="PushpinText" HorizontalAlignment="Left" TextWrapping="Wrap" VerticalAlignment="Top" Foreground="Black" Padding="10,10,10,10" />
</Border>