Silverlight VirtualEarth Map Control - 3.0 in 3D

WARNING: requires Silverlight 3.0 which is in beta. Thanks to Tim for the install experience tips.

There are Silverlight 2.0 'evoluationary versions' one, two and three too.

The Silverlight 3.0 bit... Canvas.Projection

Turns out there isn't that much Silverlight 3.0-specific stuff in this demo - just the 'faux 3D' look, which is one simple Xaml element:

<Canvas.Projection>
    <PlaneProjection x:Name="MapProjection" RotationX="-20" />
</Canvas.Projection>


Animating the center of a Silverlight Virtual Earth Map (HACK)

I freely admit this seems like a terrible hack - however without it the Map only seems to animate in one direction/axis. I'll leave it to you to spot :) Please let me know if there's a better way - I got this idea straight from twitter and the referenced animation hack post.

public static class Attachments
{
    #region Map.Center.Latitude
    public static readonly DependencyProperty CenterLatitudeProperty =
            DependencyProperty.RegisterAttached("CenterLatitude",
            typeof(double), typeof(Attachments),
            new PropertyMetadata(
                new PropertyChangedCallback(OnCenterLatitudeChanged)));
 
    public static void SetCenterLatitude(DependencyObject o, double value)
    {
        o.SetValue(CenterLatitudeProperty, value);
    }
    public static double GetCenterLatitude(DependencyObject o)
    {
        return (double)o.GetValue(CenterLatitudeProperty);
    }
    private static void OnCenterLatitudeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
    {
        if ((double)e.NewValue == 0.0) return;
        Location l = (Location)((Map)d).Center;
       // l.Latitude = (double)e.NewValue;
        myLatitude = (double)e.NewValue;
        ((Map)d).Center = l;
    }
    private static double myLatitude = 0.0;
    #endregion
    #region Map.Center.Longitude
    public static readonly DependencyProperty CenterLongitudeProperty =
           DependencyProperty.RegisterAttached("CenterLongitude",
           typeof(double), typeof(Attachments),
           new PropertyMetadata(
               new PropertyChangedCallback(OnCenterLongitudeChanged)));
 
    public static void SetCenterLongitude(DependencyObject o, double value)
    {
        o.SetValue(CenterLongitudeProperty, value);
    }
    public static double GetCenterLongitude(DependencyObject o)
    {
        return (double)o.GetValue(CenterLongitudeProperty);
    }
    private static void OnCenterLongitudeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
    {
        if ((double)e.NewValue == 0.0) return;
        Location l = (Location)((Map)d).Center;
        l.Longitude = (double)e.NewValue;
        l.Latitude = myLatitude;
        ((Map)d).Center = l;
    }
    #endregion
}

goes with this Xaml animation

<Canvas.Triggers>
    <EventTrigger RoutedEvent="Canvas.Loaded">
        <BeginStoryboard>
            <Storyboard x:Name="Timeline1">
                <!-- MAP -->
                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" 
                                               x:Name="viewmapanimX"
                                                Storyboard.TargetName="viewMap" >
                    <LinearDoubleKeyFrame KeyTime="00:00:00.000000" Value="40.6035919651948" />
                    <LinearDoubleKeyFrame KeyTime="00:00:01.803422" Value="40.609652061223" />
                    <LinearDoubleKeyFrame KeyTime="00:00:02.161213" Value="40.6110855519554" />
                    <LinearDoubleKeyFrame KeyTime="00:00:02.161213" Value="40.6110855519554" />
                    <LinearDoubleKeyFrame KeyTime="00:00:02.446789" Value="40.6135940867421" />
                    <LinearDoubleKeyFrame KeyTime="00:00:02.795569" Value="40.6165585973448" />
                    <LinearDoubleKeyFrame KeyTime="00:00:02.874122" Value="40.6168843597191" />
                    <LinearDoubleKeyFrame KeyTime="00:00:03.016841" Value="40.6157441844595" />
                    <LinearDoubleKeyFrame KeyTime="00:00:03.016841" Value="40.6157441844595" />
                    <LinearDoubleKeyFrame KeyTime="00:00:03.230106" Value="40.6166889024851" />
                    <LinearDoubleKeyFrame KeyTime="00:00:03.821501" Value="40.6228129573982" />
                    <LinearDoubleKeyFrame KeyTime="00:00:04.462031" Value="40.6294250032991" />
                    <LinearDoubleKeyFrame KeyTime="00:00:04.462031" Value="40.6294250032991" />
                    <LinearDoubleKeyFrame KeyTime="00:00:04.964983" Value="40.6346034392285" />
                    <LinearDoubleKeyFrame KeyTime="00:00:05.184287" Value="40.6368831264641" />
                    <LinearDoubleKeyFrame KeyTime="00:00:05.776196" Value="40.6414748315818" />
                    <LinearDoubleKeyFrame KeyTime="00:00:06.211106" Value="40.644828856259" />
                    <LinearDoubleKeyFrame KeyTime="00:00:06.211106" Value="40.644828856259" />
                    <LinearDoubleKeyFrame KeyTime="00:00:06.783842" Value="40.6492897735347" />
                    <LinearDoubleKeyFrame KeyTime="00:00:07.427599" Value="40.6542713213941" />
                    <LinearDoubleKeyFrame KeyTime="00:00:07.427599" Value="40.6542713213941" />
                    <LinearDoubleKeyFrame KeyTime="00:00:08.228300" Value="40.6604895944959" />
                    <LinearDoubleKeyFrame KeyTime="00:00:08.865204" Value="40.665405201206" />
                    <LinearDoubleKeyFrame KeyTime="00:00:08.865204" Value="40.665405201206" />
                    <LinearDoubleKeyFrame KeyTime="00:00:09.441721" Value="40.670287895547" />
                    <LinearDoubleKeyFrame KeyTime="00:00:10.249602" Value="40.6772858006599" />
                    <LinearDoubleKeyFrame KeyTime="00:00:11.066346" Value="40.6849663764788" />
                    <LinearDoubleKeyFrame KeyTime="00:00:11.066346" Value="40.6849663764788" />
                    <LinearDoubleKeyFrame KeyTime="00:00:11.263756" Value="40.68665858776" />
                    <LinearDoubleKeyFrame KeyTime="00:00:11.263756" Value="40.68665858776" />
                    <LinearDoubleKeyFrame KeyTime="00:00:12.492294" Value="40.6881880494493" />
                    <LinearDoubleKeyFrame KeyTime="00:00:13.458808" Value="40.6894571505858" />
                    <LinearDoubleKeyFrame KeyTime="00:00:13.458808" Value="40.6894571505858" />
                    <LinearDoubleKeyFrame KeyTime="00:00:14.325429" Value="40.6989583706469" />
                    <LinearDoubleKeyFrame KeyTime="00:00:14.497617" Value="40.7008129028035" />
                    <LinearDoubleKeyFrame KeyTime="00:00:14.497617" Value="40.7008129028035" />
                    <LinearDoubleKeyFrame KeyTime="00:00:15.344410" Value="40.7071894965545" />
                    <LinearDoubleKeyFrame KeyTime="00:00:15.699146" Value="40.7110607020489" />
                </DoubleAnimationUsingKeyFrames>
 
                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" 
                                               x:Name="viewmapanimY"
                                               Storyboard.TargetName="viewMap" >
                    <LinearDoubleKeyFrame KeyTime="00:00:00.000000" Value="-74.0542459487915" />
                    <LinearDoubleKeyFrame KeyTime="00:00:01.803422" Value="-74.0350198745728" />
                    <LinearDoubleKeyFrame KeyTime="00:00:02.161213" Value="-74.031286239624" />
                    <LinearDoubleKeyFrame KeyTime="00:00:02.161213" Value="-74.031286239624" />
                    <LinearDoubleKeyFrame KeyTime="00:00:02.446789" Value="-74.0293121337891" />
                    <LinearDoubleKeyFrame KeyTime="00:00:02.795569" Value="-74.026780128479" />
                    <LinearDoubleKeyFrame KeyTime="00:00:02.874122" Value="-74.0275955200195" />
                    <LinearDoubleKeyFrame KeyTime="00:00:03.016841" Value="-74.0287113189697" />
                    <LinearDoubleKeyFrame KeyTime="00:00:03.016841" Value="-74.0287113189697" />
                    <LinearDoubleKeyFrame KeyTime="00:00:03.230106" Value="-74.0309000015259" />
                    <LinearDoubleKeyFrame KeyTime="00:00:03.821501" Value="-74.0284109115601" />
                    <LinearDoubleKeyFrame KeyTime="00:00:04.462031" Value="-74.0256643295288" />
                    <LinearDoubleKeyFrame KeyTime="00:00:04.462031" Value="-74.0256643295288" />
                    <LinearDoubleKeyFrame KeyTime="00:00:04.964983" Value="-74.0234756469727" />
                    <LinearDoubleKeyFrame KeyTime="00:00:05.184287" Value="-74.0225744247437" />
                    <LinearDoubleKeyFrame KeyTime="00:00:05.776196" Value="-74.0178108215332" />
                    <LinearDoubleKeyFrame KeyTime="00:00:06.211106" Value="-74.0142917633057" />
                    <LinearDoubleKeyFrame KeyTime="00:00:06.211106" Value="-74.0142917633057" />
                    <LinearDoubleKeyFrame KeyTime="00:00:06.783842" Value="-74.0096998214722" />
                    <LinearDoubleKeyFrame KeyTime="00:00:07.427599" Value="-74.0045070648193" />
                    <LinearDoubleKeyFrame KeyTime="00:00:07.427599" Value="-74.0045070648193" />
                    <LinearDoubleKeyFrame KeyTime="00:00:08.228300" Value="-73.9980697631836" />
                    <LinearDoubleKeyFrame KeyTime="00:00:08.865204" Value="-73.992919921875" />
                    <LinearDoubleKeyFrame KeyTime="00:00:08.865204" Value="-73.992919921875" />
                    <LinearDoubleKeyFrame KeyTime="00:00:09.441721" Value="-73.9887142181396" />
                    <LinearDoubleKeyFrame KeyTime="00:00:10.249602" Value="-73.983006477356" />
                    <LinearDoubleKeyFrame KeyTime="00:00:11.066346" Value="-73.9780712127686" />
                    <LinearDoubleKeyFrame KeyTime="00:00:11.066346" Value="-73.9780712127686" />
                    <LinearDoubleKeyFrame KeyTime="00:00:11.263756" Value="-73.9794874191284" />
                    <LinearDoubleKeyFrame KeyTime="00:00:11.263756" Value="-73.9794874191284" />
                    <LinearDoubleKeyFrame KeyTime="00:00:12.492294" Value="-73.9658403396606" />
                    <LinearDoubleKeyFrame KeyTime="00:00:13.458808" Value="-73.9551115036011" />
                    <LinearDoubleKeyFrame KeyTime="00:00:13.458808" Value="-73.9551115036011" />
                    <LinearDoubleKeyFrame KeyTime="00:00:14.325429" Value="-73.9569997787476" />
                    <LinearDoubleKeyFrame KeyTime="00:00:14.497617" Value="-73.9575147628784" />
                    <LinearDoubleKeyFrame KeyTime="00:00:14.497617" Value="-73.9575147628784" />
                    <LinearDoubleKeyFrame KeyTime="00:00:15.344410" Value="-73.9645099639893" />
                    <LinearDoubleKeyFrame KeyTime="00:00:15.699146" Value="-73.9636516571045" />
                </DoubleAnimationUsingKeyFrames>
            </Storyboard>
        </BeginStoryboard>
    </EventTrigger>
</Canvas.Triggers>

Useful links

blog post

Download the control

Getting Started with the control

Interactive SDK

Look back at Test #1 Test #2 Test #3 and the Silverlight 3.0 beta fun