When working with the Maps control for Windows Phone OS 7.1, calling “SetMode()” on the map will result in a loss of the pan and zoom functionality.  If you want to try it yourself, I’ll put code snippets at the end of this post. 

A summary of the scenario.  It turns out instead of using SetMode(),  just use a direct assignment to the .Mode property of the map and Pan and Zoom will stay alive, aka myMaps = mode.

No, I’m not sure what the difference is but I’ve got some feelers out.  Basically SetMode() hangs Pan/Zoom, and using .Mode keeps it alive.


Code blocks, the lines commented do not work….

private void Button_Road_Click(object sender, RoutedEventArgs e)
{
    Microsoft.Phone.Controls.Maps.Core.MapMode mode = new Microsoft.Phone.Controls.Maps.RoadMode();
    //myMap.SetMode(mode, true);  // this will hang Pan/Zoom
    myMap.Mode = mode;
}

private void Button_Aerial_Click(object sender, RoutedEventArgs e)
{
    Microsoft.Phone.Controls.Maps.Core.MapMode mode = new Microsoft.Phone.Controls.Maps.AerialMode();
    //myMap.SetMode(mode, true);  // this will hang Pan/Zoom
    myMap.Mode = mode;
}


XAML for the Bing Map control, nothing special.

<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
    < Grid.RowDefinitions>
        < RowDefinition Height="*"/>
        < RowDefinition Height="80"/>
    </Grid.RowDefinitions>
    <Maps:Map x:Name="myMap" Grid.Row="0" />
    < StackPanel Grid.Row="1" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
        <Button Content="Road" Width="120" x:Name="Button_Road" Click="Button_Road_Click" />
        <Button Content="Aerial" Width="120" x:Name="Button_Aerial" Click="Button_Aerial_Click"/>
    </StackPanel>
< /Grid>



For the same of SEO, enjoy….  Hope this saves someone else a headache or two!  Write mo’ apps!