开发者

Windows Phone 7 map control: panning the map while keeping the pushpin constant

I'm working on a WP7 (mango) app which has a Bing Maps control with one pushpins on the screen. I need to be able to drag/pan the map so that the map view changes while the pushpin remains in a constant position relative on the screen. How can I achieve this? The pin al开发者_高级运维ways seems to be attached to the map and moves with the map.

(This is basically an alternative to dragging the pushpin around the map i.e. dragging the map around the pushpin).


Don't add a Location to the Pushpin. Instead just set it's Margin to the values you want. The margins are calculated from the absolute center of the Map control

That way it'll be in a fixed position. Alternatively, you can add the map on a Canvas, and just draw any element on top of the Canvas.

But why you want to do this, I really cannot imagine.

Normally a Pushpin is fixed according to a GeoLocation (a GPS coordinate), and stays at that fixed point, when you pan/drag/zoom the map. That's what the Pushpin.Location property/attribute is for.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜