Visual Basic (Declaration) | |
---|---|
Public ReadOnly Property ServiceDescription As String |
C# | |
---|---|
public string ServiceDescription {get;} |
The ServiceDescription is Read Only and cannot be modified in the client application. The setting of the value of the ServiceDescription is done when publishing a new map service via the ArcMap wizards. To accomplish this: Choose File | Share As | Service... from the menus in ArcMap; then in the Service Editor dialog, with the Item Description tab active, enter a value in the Description TextBox (see the following screen shot):
It is also possible to set/modify the ServiceDescription value after a map service has been published on ArcGIS Server. To accomplish this: log onto the ArcGIS Server Manager; click on the name of the map service, make sure the Item Description tab is active, enter a value in the Description TextBox, and click the Save and Restart button to restart the map service with the new ServiceDescription value (see the following screen shot):
How to use:
When the ArcGISTiledMapServiceLayer Initializes the ServiceDescription will be automatically populated 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 its Initial Extent to the Southern Alaska. --> <esri:Map Background="White" HorizontalAlignment="Left" Margin="0,300,0,0" Name="Map1" Height="300" VerticalAlignment="Top" Width="500" Extent="-17587650,7967965,-15815209,9031430"> <!-- Define an ArcGISTiledMapServiceLayer. Wire up the Initilized Event for code-behind functions. --> <esri:ArcGISTiledMapServiceLayer Url="http://services.arcgisonline.com/ArcGIS/rest/services/Specialty/Soil_Survey_Map/MapServer" Initialized="ArcGISTiledMapServiceLayer_Initialized"/> </esri:Map> <!-- ServiceDescription (Read Only). --> <sdk:Label Height="24" HorizontalAlignment="Left" Margin="0,88,0,0" Name="Label_ServiceDescription" VerticalAlignment="Top" Width="120" Content="ServiceDescription:"/> <TextBox Height="189" HorizontalAlignment="Left" Margin="0,105,0,0" Name="TextBox_ServiceDescription" VerticalAlignment="Top" Width="500" TextWrapping="Wrap" /> <!-- As an alternative you could bind the ArcGISTiledMapServiceLayer.ServiceDescription directly to the TextBox.Text Property and not need to put any code in the code-behind for the ArcGISTiledMapServiceLayer.Initialized Event. --> <!--<TextBox Height="69" HorizontalAlignment="Left" Margin="0,105,0,0" Name="TextBox_ServiceDescription" TextWrapping="Wrap" VerticalAlignment="Top" Width="400" Text="{Binding ElementName=Map1, Path=Layers[0].ServiceDescripton}"/>--> <!-- Provide the instructions on how to use the sample code. --> <TextBlock Height="52" HorizontalAlignment="Left" Name="TextBlock1" VerticalAlignment="Top" Width="500" TextWrapping="Wrap" Text="When the ArcGISTiledMapServiceLayer Initializes the ServiceDescription will be automatically populated in the TextBlock." /> </Grid> |
C# | Copy Code |
---|---|
private void ArcGISTiledMapServiceLayer_Initialized(object sender, System.EventArgs e) { // Get the first layer in the Map. ESRI.ArcGIS.Client.ArcGISTiledMapServiceLayer myArcGISTiledMapServiceLayer = null; myArcGISTiledMapServiceLayer = (ESRI.ArcGIS.Client.ArcGISTiledMapServiceLayer)(Map1.Layers[0]); // ArcGISTiledMapServiceLayer.ServiceDescription (Read Only). // NOTE: The ArcGISTiledMapServiceLayer.ServiceDescription information is set when publishing a map service // in ArcMap via the File | Share As | Service... menus. In the 'Service Editor' dialog with the // 'Item Description' tab active, the map service author can set the 'Description' value (which is the // ArcGISTiledMapServiceLayer.ServiceDescription Property). TextBox_ServiceDescription.Text = myArcGISTiledMapServiceLayer.ServiceDescription; } |
VB.NET | Copy Code |
---|---|
Private Sub ArcGISTiledMapServiceLayer_Initialized(ByVal sender As System.Object, ByVal e As System.EventArgs) ' Get the first layer in the Map. Dim myArcGISTiledMapServiceLayer As ESRI.ArcGIS.Client.ArcGISTiledMapServiceLayer myArcGISTiledMapServiceLayer = CType(Map1.Layers.Item(0), ESRI.ArcGIS.Client.ArcGISTiledMapServiceLayer) ' ArcGISTiledMapServiceLayer.ServiceDescription (Read Only). ' NOTE: The ArcGISTiledMapServiceLayer.ServiceDescription information is set when publishing a map service ' in ArcMap via the File | Share As | Service... menus. In the 'Service Editor' dialog with the ' 'Item Description' tab active, the map service author can set the 'Description' value (which is the ' ArcGISTiledMapServiceLayer.ServiceDescription Property). TextBox_ServiceDescription.Text = myArcGISTiledMapServiceLayer.ServiceDescription End Sub |
Target Platforms: Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family, Windows 7, Windows 8