继续上一节,我们有时候要程序运行后,就显示特定区域的地图,这时我们需要要 ArcGIS API for Silverlight中的Map控件的Extent标签,下面以地图加载时显示中国地图为例

<UserControl x:Class="ArcGisSilverlight.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:esri="clr-namespace:ESRI.ArcGIS.Client;assembly=ESRI.ArcGIS.Client"
xmlns:esriGeometry="clr-namespace:ESRI.ArcGIS.Client.Geometry;assembly=ESRI.ArcGIS.Client"
d:DesignHeight="300" d:DesignWidth="400">
<!--Extent标签
用来初始地图的范围,通过设置4格数值指定min x,min y,max x,max y
相当于于BingMap for Silverlight中的2个Location点Location(60,60) 和另一点Location(13,140)来初始化地图为中国地图
-->
<Grid x:Name="LayoutRoot">
<esri:Map x:Name="MyMap" Extent="60,60,140,13">
<esri:ArcGISTiledMapServiceLayer ID="StreetMapLayer" Url="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer"/>
<!--<esri:Map.Extent>
<esriGeometry:Envelope XMin="661140" YMin="-1420246" XMax="3015668" YMax="1594451" >
<esriGeometry:Envelope.SpatialReference>
<esriGeometry:SpatialReference WKID="26777"/>
</esriGeometry:Envelope.SpatialReference>
</esriGeometry:Envelope>
</esri:Map.Extent>-->
</esri:Map>
</Grid>
</UserControl>
