如何在bing map图钉中应用弹出窗口

时间:2013-03-02 09:33:10

标签: windows-phone-7 bing-maps pushpin

我有bing map controll,其中有很多maplayer

我想在我的图钉点击事件中显示弹出窗口,就像这样

Bing Maps Gets New Look for Pushpins, Popups, And Transit - See more at: http://wmpoweruser.com/bing-maps-gets-new-look-for-pushpins-popups-and-transit/#sthash.ApL3q6bA.dpuf

我如何做到这一点。

给我一​​些关于在bing map controll中开发弹出窗口的建议,是的,我想在这个弹出窗口中显示纬度,经度和地址

Mu pushin代码

 void _ClsGetDeviceMap_WorkFinished(bool success)
        {
            try
            {
                if (ClsGetDeviceMap.lstresponsecode.ElementAt<string>(0).Trim() == "1")
                {
                    MessageBox.Show(ClsGetDeviceMap.lstresponsemsg.ElementAt<string>(0));

                    for (int i = 0; i <= ClsGetDeviceMap.lstLongLatitude.Count - 1; i++)
                    {
                        string lat, lon;
                        lat = ClsGetDeviceMap.lstLatitude.ElementAt<string>(i).Trim();
                        lon = ClsGetDeviceMap.lstLongLatitude.ElementAt<string>(i).Trim();
                        Latitude = Convert.ToDouble(lat);
                        LongLatitude = Convert.ToDouble(lon);
                        GpsSpeed = 44.21811;

                        map1.Center = new GeoCoordinate(Latitude, LongLatitude, GpsSpeed);
                        map1.ZoomLevel = 17;
                        map1.ZoomBarVisibility = Visibility.Visible;


                        imglayer[i] = new MapLayer();
                        Image img = new Image();
                        img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri("/ReachMe;component/Images/mappinicn.png", UriKind.Relative));
                        img.Opacity = 0.8;
                        img.Stretch = System.Windows.Media.Stretch.None;
                        GeoCoordinate location = new GeoCoordinate() { Latitude = Latitude, Longitude = LongLatitude };
                        PositionOrigin position = PositionOrigin.Center;                        
                        imglayer[i].AddChild(img, location, position);

                        Pushpin pin = new Pushpin();

                        ToolTipService.SetToolTip(pin, "Pushpin 1\r\nThis is the first pushpin infobox.");
                        imglayer[i].Children.Add(pin);

                        map1.Children.Add(imglayer[i]);
                        myCoorditeWatcher = new GeoCoordinateWatcher(GeoPositionAccuracy.High);
                        myCoorditeWatcher.MovementThreshold = 20;

                        var g1 = GestureService.GetGestureListener(imglayer[i]);
                        g1.Tap += new EventHandler<GestureEventArgs>(g1_Tap);

                    }

                }
                else// if error
                {
                    MessageBox.Show("No Data Between This data");
                   // NavigationService.Navigate(new Uri("/ReachMeView/Login.xaml", UriKind.RelativeOrAbsolute));
                }
            }
            catch (Exception ex)
            {
                Error.WriteErrorLog(ex.ToString(), "MainPage.xaml", "Data_WorkFinished");
            }
        }

        void g1_Tap(object sender, GestureEventArgs e)
        {
            for (int i = 0; i <= ClsGetDeviceMap.lstLongLatitude.Count - 1; i++)
            {
                if (sender.Equals(imglayer[i]))
                {
                    MessageBox.Show(ClsGetDeviceMap.lstLocationName.ElementAt<string>(i).Trim());
                    MessageBox.Show(ClsGetDeviceMap.lstLatitude.ElementAt<string>(i).Trim());
                    MessageBox.Show(ClsGetDeviceMap.lstLongLatitude.ElementAt<string>(i).Trim());
                    MessageBox.Show(ClsGetDeviceMap.lstDate.ElementAt<string>(i).Trim());                   
                }
            }
        }

0 个答案:

没有答案