ArcGIS Runtime SDK for WPF - Library Reference
MapName Property
See Also  Example
ESRI.ArcGIS.Client Namespace > ArcGISDynamicMapServiceLayer Class : MapName Property

Gets the name of the ArcGISDynamicMapServiceLayer hosted by a map service.

Syntax

Visual Basic (Declaration) 
Public ReadOnly Property MapName As String
C# 
public string MapName {get;}

Remarks

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 ArcGISDynamicMapServiceLayer.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):

Changing the Name value of the Data Frame in ArcMap.

Example

How to use:

When the application loads the ArcGISDynamicMapServiceLayer.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.

Displaying the ArcGISDynamicMapServiceLayer.MapName Property.

XAMLCopy Code
<Grid x:Name="LayoutRoot">
  
  <!-- Add a Map Control. Set the Extent to the area of the country of Belize. -->
  <esri:Map Background="White" HorizontalAlignment="Left" Margin="0,146,0,0" Name="Map1" VerticalAlignment="Top" 
            WrapAround="True" Height="334" Width="462" Extent="-10199235,1673499,-9348562,2288487">
    <esri:Map.Layers>
      <esri:LayerCollection>
             
        <!-- Add an ArcGISDynamicMapServiceLayer. Note the Initialized Event is wired up with code-behind. -->
        <esri:ArcGISDynamicMapServiceLayer ID="World_Street_Map" Initialized="ArcGISDynamicMapServiceLayer_Initialized"
              Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" />
      </esri:LayerCollection>
    </esri:Map.Layers>
  </esri:Map>
    
  <!-- Display the ArcGISDynamicMapServiceLayer.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="ArcGISDynamicMapServiceLayer.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 ArcGISDynamicMapServiceLayer.MapName will be displayed in the TextBlock." />
  
</Grid>
C#Copy Code
private void ArcGISDynamicMapServiceLayer_Initialized(object sender, System.EventArgs e)
{
  // Get the first layer in the LayerInfo collection. 
  ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer myArcGISDynamicMapServiceLayer = null;
  myArcGISDynamicMapServiceLayer = (ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer)(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 = myArcGISDynamicMapServiceLayer.MapName;
}
VB.NETCopy Code
Private Sub ArcGISDynamicMapServiceLayer_Initialized(sender As System.Object, e As System.EventArgs)
  
  ' Get the first layer in the LayerInfo collection. 
  Dim myArcGISDynamicMapServiceLayer As ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer
  myArcGISDynamicMapServiceLayer = CType(Map1.Layers.Item(0), ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer)
  
  ' 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 = myArcGISDynamicMapServiceLayer.MapName
  
End Sub

Requirements

Target Platforms: Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family, Windows 7, Windows 8

See Also

© ESRI, Inc. All Rights Reserved.