【问题标题】:Bing Maps on Windows Store Apps (C#/XAML) display popup when pushpin tappedWindows 应用商店应用程序 (C#/XAML) 上的 Bing 地图在点击图钉时显示弹出窗口
【发布时间】:2013-01-05 12:08:33
【问题描述】:

我在我的 Windows 应用商店应用中使用 Bing 地图,我显示了一些带有一些位置的图钉。

我想要做的是当用户点击图钉时,会出现一个弹出窗口,其中包含与该图钉位置相关的一些信息。类似于用户在 Microsoft 地图应用程序中点击我的位置时的弹出窗口

如何做到这一点?

【问题讨论】:

    标签: windows-8 windows-runtime winrt-xaml bing bing-maps


    【解决方案1】:

    非常简单,您可以使用 PushpinTapped 事件触发弹出窗口,然后使用 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);
    }
    

    尝试使用 Popup 控件或类似的假控件

    您可以使用 Popup 控件(请参阅 MSDN documentation here)或切换 Border 元素的可见性以使用 @ 伪造 Popup 987654327@,试试这个

    <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>
    

    【讨论】:

    • 谢谢,我已经知道了,问题是如何创建弹出窗口并在点击时显示?
    • 非常感谢,我使用了一个弹出窗口,它像孩子一样接受边境控制
    猜你喜欢
    • 1970-01-01
    • 2014-04-19
    • 1970-01-01
    • 2013-03-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多