Visual Basic (Declaration) | |
---|---|
Public ReadOnly Property MapName As String |
C# | |
---|---|
public string MapName {get;} |
ArcGIS Server REST map services only support the default data frame (map). See the document Using data frames for more details about using data frames in ArcMap.
Unless the Name value is changed in the General tab of the Data Frame Properties dialog of ArcMap by the user before the map service is published in ArcGIS Server, the ArcGISTiledMapServiceLayer.MapName will be the string "Layers" (the default value). In ArcMap, choose the View | Data Frame Properties... menus to open the Data Frame Properties dialog and in the General tab adjust the Name value (see the following screen shot):
How to use:
When the application loads the ArcGISTiledMapServiceLayer.MapName will be displayed in the TextBlock.
The XAML code in this example is used in conjunction with the code-behind (C# or VB.NET) to demonstrate the functionality.
The following screen shot corresponds to the code example in this page.
XAML | Copy Code |
---|---|
<Grid x:Name="LayoutRoot"> <!-- Add a Map Control. Set the Extent to the area of the Falkland Islands. --> <esri:Map Background="White" HorizontalAlignment="Left" Margin="0,146,0,0" Name="Map1" VerticalAlignment="Top" WrapAround="True" Height="334" Width="462" Extent="-6812193,-6932563,-6386857,-6625069"> <esri:Map.Layers> <esri:LayerCollection> <!-- Add an ArcGISTiledMapServiceLayer. Note the Initialized Event is wired up with code-behind. --> <esri:ArcGISTiledMapServiceLayer ID="World_Street_Map" Initialized="ArcGISTiledMapServiceLayer_Initialized" Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" /> </esri:LayerCollection> </esri:Map.Layers> </esri:Map> <!-- Display the ArcGISTiledMapServiceLayer.MapName to the user. --> <TextBlock Height="23" HorizontalAlignment="Left" Margin="250,118,0,0" Name="TextBlock_MapName" VerticalAlignment="Top" Width="212" /> <sdk:Label Height="23" HorizontalAlignment="Left" Margin="2,120,0,0" Name="Label1" VerticalAlignment="Top" Width="252" Content="ArcGISTiledMapServiceLayer.MapName:"/> <!-- Provide the instructions on how to use the sample code. --> <TextBlock Height="52" HorizontalAlignment="Left" Name="TextBlock1" VerticalAlignment="Top" Width="462" TextWrapping="Wrap" Text="When the application loads the ArcGISTiledMapServiceLayer.MapName will be displayed in the TextBlock." /> </Grid> |
C# | Copy Code |
---|---|
private void ArcGISTiledMapServiceLayer_Initialized(object sender, System.EventArgs e) { // Get the first layer in the LayerInfo collection. ESRI.ArcGIS.Client.ArcGISTiledMapServiceLayer myArcGISTiledMapServiceLayer = null; myArcGISTiledMapServiceLayer = (ESRI.ArcGIS.Client.ArcGISTiledMapServiceLayer)(Map1.Layers[0]); // MapName Property (Read Only). Unless the 'Name' property is changed in the 'General' tab of the // 'Data Frame Properties' dialog of ArcMap by the user when service is published, the MapName will // be the string "Layers" (the default value). TextBlock_MapName.Text = myArcGISTiledMapServiceLayer.MapName; } |
VB.NET | Copy Code |
---|---|
Private Sub ArcGISTiledMapServiceLayer_Initialized(sender As System.Object, e As System.EventArgs) ' Get the first layer in the LayerInfo collection. Dim myArcGISTiledMapServiceLayer As ESRI.ArcGIS.Client.ArcGISTiledMapServiceLayer myArcGISTiledMapServiceLayer = CType(Map1.Layers.Item(0), ESRI.ArcGIS.Client.ArcGISTiledMapServiceLayer) ' MapName Property (Read Only). Unless the 'Name' property is changed in the 'General' tab of the ' 'Data Frame Properties' dialog of ArcMap by the user when service is published, the MapName will ' be the string "Layers" (the default value). TextBlock_MapName.Text = myArcGISTiledMapServiceLayer.MapName End Sub |
Target Platforms: Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family, Windows 7, Windows 8