Silverlight VirtualEarth Map Control - test #3

After the first two attempts, this one kinda works! The image and animation both pan AND zoom/scale successfully - the only remaining problem is they don't scale in 'real time' (so I hide them while the zoom is in progress).

It was originally built as an example for my blog, however it wasn't as straight-forward as I expected, so I raised a bug. The MS guys aren't convinced - I just thought this would be easier than it was :-(

The Code

You can view most of the code required to get this effect (I've removed the animation timelines for clarity):

In the Xaml I'd originally set up the CourseScaleTranslate TranslateTransform as m:MapLayer.MapPositionOffset (expecting that to be 'in pixels' and 'scaled'). Admittedly as a CTP there doesn't seem to be a lot of doco around, so my assumption is probably incorrect; anyway I had to move it to a TranslateTransform and then 'manually scale' it in C#.

All the 'manual scaling' is done in the viewMap_ViewChangeEnd method. I have looked at wiring up the ViewChangeOnFrame event, but it wasn't working for me straight away so I just 'hide' my bits during zoom and show them again once the new zoom level has been reached.

Also, you will probably find the viewMap_ViewChangeEnd quite ugly - I started out with lots of hardcoded numbers for scaling (eg. 1.245 is the fixed ratio I NEEDED to make the pre-drawn animation work) and some of the hardcoded numbers/if-else statements remain (hey - it's getting late!).

Final note - in viewMap_ViewChangeStart we hide stuff before a scale (but not a pan), which is why we stored the currentZoom.

Here is the result: zoomed in and out

Useful links

Connect Bug Report

blog post

Download the control

Getting Started with the control

Interactive SDK