Windows Phone 7 – Bing Map Phone/Desktop diffs: MapLayer.SetPosition() missing on Phone

October 2, 2010 10:54 pm

If you’re working on a Windows Phone 7 app that uses the Bing Map control, you might be interested in these little differences between the Desktop version and the Phone version of the map control.

1. The Location type on the Phone has no constructor that takes 2 parameters (the Desktop version does). You’ll have to construct a Location object with the default constructor and then set the Latitude and Longitude fields separately.

2. LocationRect also has no constructor that takes 2 parameters. Here you’ll need to do a little more work and assign the North, West, South and East fields appropriately after constructing a LocationRect object with the default constructor.

3. MapLayer has no static function called SetPosition that lets you map Location objects to something appropriate for a MapLayer. Use the regular instance member MapLayer.AddChild() instead.

With these changes, you can make the Desktop sample on the Bing developer site work on a Windows Phone 7 device.

7 Responses to “Windows Phone 7 – Bing Map Phone/Desktop diffs: MapLayer.SetPosition() missing on Phone”

Frank Rizzo wrote a comment on October 23, 2010

Thanks, dude. I was ripping my hair out for item #3.

GeekTieGuy wrote a comment on October 24, 2010

:)

Mike wrote a comment on November 21, 2010

How do you change the location of a UIElement that is a child of the MapLayer and that has already been added as a child at design time? We used to be able to use SetPosition on the desktop to do that. On WinPho, are you saying you have to remove and add each time?

Mike wrote a comment on November 21, 2010

Btw, i have tried using ‘ mapLayer.SetValue(MapLayer.PositionProperty, location);’, but a run time exception is thrown complaining about the values for location being invalid for property ‘Position’, regardless of what values i try.

GeekTieGuy wrote a comment on December 4, 2010

Sorry mate, haven’t had time to play with that since I wrote the post. Don’t know.

www.iherb.com wrote a comment on January 14, 2014

When I initially commented I clicked the “Notify me when new comments are added”
checkbox and now each time a comment is added I get three emails with the same comment.
Is there any way you can remove me from that service?
Thank you!

GeekTieGuy wrote a comment on January 15, 2014

The WordPress management interface does not have an option for the administrator to help with that, as far as I can tell. Comments I’ve read elsewhere (http://en.forums.wordpress.com/topic/temporarily-turn-off-post-notification-to-followers) seem to indicate that anyone who checks the “notify me” box on a post can unsubscribe themselves (probably via the link that was sent initially on turning on the option).

Care to comment?

%d bloggers like this: