Intercepting Map Moved

Jun 9, 2009 at 9:58 AM

Hi,

I'm using your code to develop a Surface app and I'd firstly like to say how great it is!

I'm new to C#, WPF and the Surface SDK (so it's a rather steep curve!), my apologies if there are obvious solutions.

I'd like to intercept an event when the map is moved (to remove some Scattered images): Is there an elegant way to do this?

Ideally I'd also like to check if a Pushpin is actually on the screen and get its screen co-ordinates too.

Thanks again for sharing this code,

Bruce

 

Jun 9, 2009 at 10:08 AM

Ah, I found the thread to answer the Screen coordinates part, sorry, should read twice and post once I guess...

public Point? LatLongToPoint(VELatLong latLong);

public VELatLong PointToLatLong(Point? point);

Bruce

Coordinator
Jun 10, 2009 at 1:19 AM
Edited Jun 10, 2009 at 12:05 PM

There have been requests for map/camera moved events. Those should be in the next release.

http://virtualearthwpf.codeplex.com/WorkItem/View.aspx?WorkItemId=2920

 

In the meantime, you can check the current latitude, longitude, or altitude during a PreviewContactChangedEvent without setting e.Handled.

For example: (may not compile, didn't test in VS)

<SurfaceVEMap s:Contacts.PreviewContactChanged="map_PreviewContactChanged" ... />

then in the code behind:

private void map_PreviewContactChanged(object sender, ContactEventArgs e)

{

      //Check map's lat, long, altitude and take action on your SVI if necessary

     //do not set e.Handled = true (it defaults to false) so the contact changed event will continue to route to the control and down the UI tree.

}

 

Jun 10, 2009 at 8:52 AM

Thanks Josh,

That works great, exactly what I needed.

I really appreciate your prompt reply!

Bruce