Select to view content in your preferred language

linking map extents for multiple maps

674
0
08-23-2013 06:26 AM
DanielSchatt
Regular Contributor
hi all, I have multiple maps in my application and I'd like to link their map extents together so that as one pans or zooms in/out on one map, the other(s) will change to that same new extent.  So I've been trying to use the ExtentChanged event in the map tags, from previous threads this appears to be the way to do this.  But my application isn't loading, i.e. just hangs upon initial loading and never displays the map application.

I'm not certain but I suspect there's an issue with the MapExtent event being fired upon loading before the layers are initialized.  I tried a workaround using the LayersInitialized event that was suggested in a previous thread but no luck. So if that is the issue, I'm obviously not coding that properly.  Basic code below, thanks much for any assistance..

Dan


XAML:
<esri:Map x:Name="SeaLevelRiseMapHighest" Background="White" RenderTransformOrigin="-2.037,-2.183" IsLogoVisible="False" Extent="-8511763,4442106,-8481883,4450940" TimeExtent="{Binding ElementName=MyTimeSlider, Path=Value, Mode=OneWay}" Loaded="SeaLevelRiseMapHighest_Loaded" Style="{StaticResource MyMapStyle}" ExtentChanged="SeaLevelRiseMapHighest_ExtentChanged" > 

<esri:Map x:Name="SeaLevelRiseMapHigh" Background="White" RenderTransformOrigin="-2.037,-2.183" IsLogoVisible="False" Extent="-8511763,4442106,-8481883,4450940" TimeExtent="{Binding ElementName=MyTimeSlider, Path=Value, Mode=OneWay}"  Loaded="SeaLevelRiseMapHigh_Loaded" Style="{StaticResource MyMapStyle}" ExtentChanged="SeaLevelRiseMapHigh_ExtentChanged" >


Code-behind:
private void SeaLevelRiseMapHighest_ExtentChanged(object sender, System.Windows.RoutedEventArgs e)
{
       ESRI.ArcGIS.Client.Geometry.Envelope mapExtent = SeaLevelRiseMapHighest.Extent;
       SeaLevelRiseMapHigh.ZoomTo(mapExtent);
}


private void SeaLevelRiseMapHigh_ExtentChanged(object sender, System.Windows.RoutedEventArgs e)
{
        ESRI.ArcGIS.Client.Geometry.Envelope mapExtent = SeaLevelRiseMapHigh.Extent;
        SeaLevelRiseMapHighest.ZoomTo(mapExtent);
}
0 Kudos
0 Replies