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 ArcGISDynamicMapServiceLayer 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 US and Central America. --> <esri:Map Background="White" HorizontalAlignment="Left" Margin="0,300,0,0" Name="Map1" Height="300" VerticalAlignment="Top" Width="500" Extent="-12295277,1356759,-7182465,4424446"> <!-- Define an ArcGISDynamicMapServiceLayer. Wire up the Initilized Event for code-behind functions. --> <esri:ArcGISDynamicMapServiceLayer Url="http://services.arcgisonline.com/ArcGIS/rest/services/Specialty/Soil_Survey_Map/MapServer" Initialized="ArcGISDynamicMapServiceLayer_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 ArcGISDynamicMapServiceLayer.ServiceDescription directly to the TextBox.Text Property and not need to put any code in the code-behind for the ArcGISDynamicMapServiceLayer.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 ArcGISDynamicMapServiceLayer Initializes the ServiceDescription will be automatically populated in the TextBlock." /> </Grid> |
C# | Copy Code |
---|---|
private void ArcGISDynamicMapServiceLayer_Initialized(object sender, System.EventArgs e) { // Get the first layer in the Map. ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer myArcGISDynamicMapServiceLayer = null; myArcGISDynamicMapServiceLayer = (ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer)(Map1.Layers[0]); // ArcGISDynamicMapServiceLayer.ServiceDescription (Read Only). // NOTE: The ArcGISDynamicMapServiceLayer.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 // ArcGISDynamicMapServiceLayer.ServiceDescription Property). TextBox_ServiceDescription.Text = myArcGISDynamicMapServiceLayer.ServiceDescription; } |
VB.NET | Copy Code |
---|---|
Private Sub ArcGISDynamicMapServiceLayer_Initialized(ByVal sender As System.Object, ByVal e As System.EventArgs) ' Get the first layer in the Map. Dim myArcGISDynamicMapServiceLayer As ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer myArcGISDynamicMapServiceLayer = CType(Map1.Layers.Item(0), ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer) ' ArcGISDynamicMapServiceLayer.ServiceDescription (Read Only). ' NOTE: The ArcGISDynamicMapServiceLayer.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 ' ArcGISDynamicMapServiceLayer.ServiceDescription Property). TextBox_ServiceDescription.Text = myArcGISDynamicMapServiceLayer.ServiceDescription End Sub |
Target Platforms: Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family, Windows 7