Windows Phone 7-地图PushPin是否不随地图一起移动? [英] Windows Phone 7 - Map PushPin not moving with the map?

查看:70
本文介绍了Windows Phone 7-地图PushPin是否不随地图一起移动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有点奇怪.我最近开始WP7开发,并尝试移植到我编写的iOS应用程序上.该应用程序的一部分涉及使用纬度和经度在地图上放置图钉.我使用以下方法工作正常:

Bit of a weird one. I've recently started WP7 development and trying to port over an iOS app I have written. One part of the application involves placing a pin on a map using a latitude and longitude. I have this working fine using:

  Pushpin pushpin = new Pushpin();
  Location location = new Location();
  location.Latitude = lat;
  location.Longitude = lng;
  pushpin.Location = location;
  pushpin.Name = name;
  MyMap.Children.Add(pushpin);

该图钉看起来不错,但是当我拖动地图或缩放时,该图钉停留在屏幕的中心点,而不是在与地图相关的位置.因此,如果用户向左拖动地图,则图钉会停留在屏幕中心的位置,而不是固定在地图上的坐标上.

The pin appears fine, however when I drag the map or Zoom, the pin stays at the centre point of the screen and not in its location relevant to the map. So if the user drags the map left, the pin stays in it's position at the centre of the screen rather than sticking to it's coordinate on the map.

是否需要设置某些内容,但是我目前正在丢失?感谢您的帮助

Is there something I need to be setting but I am currently missing? Thanks for any help

推荐答案

在我看来,您可能会受益于使用GeoCoordinate类和ViewModel将位置数据绑定到应用程序控件.

It looks to me like you might benefit from making use of the GeoCoordinate class and a ViewModel to bind your location data to application controls.

刚刚发布了一些示例,这些示例应该可以为您提供帮助.从地理位置iPhone到Windows Phone的迁移示例( http://windowsphone.interoperabilitybridges.com/articles/iphone-to-windows-phone-geo-location )直接适用于您的情况.您可以通过本文底部的链接下载iOS和Windows Phone示例.

A few samples have just been published that should be able to help you. The Geo-Location iPhone to Windows Phone migration sample (http://windowsphone.interoperabilitybridges.com/articles/iphone-to-windows-phone-geo-location) is directly applicable to your situation. You can download both the iOS and Windows Phone samples via links at the bottom of the article.

这篇关于Windows Phone 7-地图PushPin是否不随地图一起移动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆