ArcGIS API for Silverlight - Library Reference
GetDetails Method
See Also  Example Send comments on this topic
ESRI.ArcGIS.Client Namespace > ArcGISDynamicMapServiceLayer Class : GetDetails Method

id
The sub-layer or table id.
onCompleted
The method to call when details of the sub-layer or table is retrieved.
Gets the sub-layer or table details (for a specific ID) of an ArcGISDynamicMapServiceLayer.

Syntax

Visual Basic (Declaration) 
Public Sub GetDetails( _
   ByVal id As Integer, _
   ByVal onCompleted As Action(Of FeatureLayerInfo,Exception) _
) 
C# 
public void GetDetails( 
   int id,
   Action<FeatureLayerInfo,Exception> onCompleted
)

Remarks

The GetDetails Method returns a FeatureLayerInfo object for a specific sub-layer ID. The FeatureLayerInfo object is rich with numerous Properties that can be used to get metadata information about the ArcGISDynamicMapServiceLayer web service. To get the details for all sub-layers in an ArcGISDynamicMapServiceLayer consider using the ArcGISDynamicMapServiceLayer.GetAllDetails instead.

For most ArcGISDynamicMapServiceLayer Properties that have both get/set (C#) or Read/Write (VB.NET) Properties, accessing the get/Read for a particular Property will return null/Nothing from ArcGIS Server. The exceptions are DisableClientCaching which returns false and ImageFormat which returns ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer.RestImageFormat.PNG32; these are the default values. For all other get/set (C#) or Read/Write (VB.NET) Property values, in order to obtain get/Read information the application developer must first set/Write the values. Use the various ArcGISDynamicMapServiceLayer Methods to serve as a starting point to obtain ArcGIS Server metadata information for the set/Write Properties.

Parameters

id
The sub-layer or table id.
onCompleted
The method to call when details of the sub-layer or table is retrieved.

Example

How to use:

When the application loads an ArcGISDynamicMapServiceLayer will display. One of the sub-layers has a LayerDefinition value specified which restrict how many features are returned in the Map. Click your cursor in the TextBox for the sub-layer LayerDefinition and modify it. Then click the Button to see the changes. If you type a bogus LayerDefintion in the TextBox for the sub-layer, it will not display. Use the "1=1" to return all features for the sub-layer.

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.

Example showing how to get and change the sub-layer LayerDefintion on an ArcGISDynamicMapServiceLayer.

XAMLCopy Code
<Grid x:Name="LayoutRoot">
  
  <!-- Add a Map Control and zoom into an area of interest that shows useful information. -->
  <esri:Map Background="White" HorizontalAlignment="Left" Margin="7,311,0,0" Name="Map1" 
            VerticalAlignment="Top" Height="283" Width="616" Extent="13414332,392041,13415767,392701">
    
    <!-- Add an ArcGISDynamicMapServiceLayer. Wire up an Initialized Event to give back the LayerDefinition
         for a specific sub-layer that users can tweak to modify the results.-->
    <esri:ArcGISDynamicMapServiceLayer ID="MyUniqueName"
          Url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/BloomfieldHillsMichigan/Parcels/MapServer" 
          Initialized="ArcGISDynamicMapServiceLayer_Initialized" />
      
  </esri:Map>
  
  <!-- Add a Button to apply to modify ArcGISDynamicMapServiceLayer.LayerDefinitions. -->
  <Button Content="Apply New LayerDefinition" Height="23" HorizontalAlignment="Left" Margin="7,282,0,0" 
          Name="Button_ApplyNewLayerDefinition" VerticalAlignment="Top" Width="184" 
          Click="Button_ApplyNewLayerDefinition_Click"/>
      
  <TextBox Height="23" HorizontalAlignment="Left" Margin="206,282,0,0" Name="TextBox1" 
           VerticalAlignment="Top" Width="417" />
    
  <!-- Provide the instructions on how to use the sample code. -->
  <TextBlock Height="102" HorizontalAlignment="Left" Name="TextBlock1" VerticalAlignment="Top" Width="756" TextWrapping="Wrap" 
             Text="When the application loads an ArcGISDynamicMapServiceLayer will display. One of the sub-layers has 
             a LayerDefinition value specified which restrict how many features are returned in the Map. Click 
             your cursor in the TextBox for the sub-layer LayerDefinition and modify it. Then click the Button 
             to see the changes. If you type a bogus LayerDefintion in the TextBox for the sub-layer, it will 
             not display. Use the '1=1' to return all features for the sub-layer." />
    
</Grid>
C#Copy Code
private void ArcGISDynamicMapServiceLayer_Initialized(object sender, System.EventArgs e)
{
  
  // When the ArcGISDynamicMapServiceLayer Initializes get the LayerDefinition expression for a specific sub-layer.
  // It is necessary to use the ArcGISDynamicMapServiceLayer.GetDetails Method to obtain the LayerDefintion
  // for the sub-layer of the web service on ArcGIS Server. 
  // NOTE: You can not use the ArcGISDynamicMapServiceLayer.LayerDefinitions Property to obtain these values as 
  // this the Property will always return null/Nothing. 
  
  // Get the ArcGISDynamicMapServiceLayer from the Map Control by its ID value that was set in XAML.
  ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer myArcGISDynamicMapServiceLayer = (ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer)(Map1.Layers["MyUniqueName"]);
  
  // Get the details for the first (i.e. 0) sub-layer and display it's DefinitionExpression in the TextBox.
  myArcGISDynamicMapServiceLayer.GetDetails(0, (ESRI.ArcGIS.Client.FeatureService.FeatureLayerInfo myFeatureLayerInfo, Exception myException) => 
      {
        if (myException == null)
        {
          TextBox1.Text = myFeatureLayerInfo.DefinitionExpression;
        }
      });
}
            
private void Button_ApplyNewLayerDefinition_Click(object sender, System.Windows.RoutedEventArgs e)
{
  // This function will apply the user changes to the sub-layer LayerDefintion to produce a new map
  // with different features returned.
  
  // Get the ArcGISDynamicMapServiceLayer from the Map Control by its ID value that was set in XAML.
  ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer myArcGISDynamicMapServiceLayer = (ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer)(Map1.Layers["MyUniqueName"]);
  
  // Create an ObservableCollection of sub-layer LayerDefinitions. 
  System.Collections.ObjectModel.ObservableCollection<ESRI.ArcGIS.Client.LayerDefinition> myObservableCollection = new System.Collections.ObjectModel.ObservableCollection<ESRI.ArcGIS.Client.LayerDefinition>();
  
  // Create a new LayerDefinition object for the first (i.e. 0) sub-layer. Set the ID and Definition values.
  ESRI.ArcGIS.Client.LayerDefinition myDefinition = new ESRI.ArcGIS.Client.LayerDefinition();
  myDefinition.LayerID = 0;
  myDefinition.Definition = TextBox1.Text;
  myObservableCollection.Add(myDefinition);
  
  // Apply the custom LayerDefinition to the ArcGISDynamicMapServiceLayer.
  myArcGISDynamicMapServiceLayer.LayerDefinitions = myObservableCollection;
  
  // Need to invoke the Refresh Method to redraw the sub-layer in the ArcGISDynamicMapServiceLayer.
  myArcGISDynamicMapServiceLayer.Refresh();
}
VB.NETCopy Code
Private Sub ArcGISDynamicMapServiceLayer_Initialized(ByVal sender As System.Object, ByVal e As System.EventArgs)
  
  ' When the ArcGISDynamicMapServiceLayer Initializes get the LayerDefinition expression for a specific sub-layer.
  ' It is necessary to use the ArcGISDynamicMapServiceLayer.GetDetails Method to obtain the LayerDefintion
  ' for the sub-layer of the web service on ArcGIS Server. 
  ' NOTE: You can not use the ArcGISDynamicMapServiceLayer.LayerDefinitions Property to obtain these values as 
  ' this the Property will always return null/Nothing. 
  
  ' Get the ArcGISDynamicMapServiceLayer from the Map Control by its ID value that was set in XAML.
  Dim myArcGISDynamicMapServiceLayer As ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer = CType(Map1.Layers("MyUniqueName"), ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer)
  
  ' Get the details for the first (i.e. 0) sub-layer and display it's DefinitionExpression in the TextBox.
  myArcGISDynamicMapServiceLayer.GetDetails(0, Sub(myFeatureLayerInfo As ESRI.ArcGIS.Client.FeatureService.FeatureLayerInfo, myException As Exception)
                                                If myException Is Nothing Then
                                                  TextBox1.Text = myFeatureLayerInfo.DefinitionExpression
                                                End If
                                               End Sub)
  
End Sub
            
Private Sub Button_ApplyNewLayerDefinition_Click(sender As System.Object, e As System.Windows.RoutedEventArgs)
  
  ' This function will apply the user changes to the sub-layer LayerDefintion to produce a new map
  ' with different features returned.
  
  ' Get the ArcGISDynamicMapServiceLayer from the Map Control by its ID value that was set in XAML.
  Dim myArcGISDynamicMapServiceLayer As ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer = CType(Map1.Layers("MyUniqueName"), ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer)
  
  ' Create an ObservableCollection of sub-layer LayerDefinitions. 
  Dim myObservableCollection As New System.Collections.ObjectModel.ObservableCollection(Of ESRI.ArcGIS.Client.LayerDefinition)
  
  ' Create a new LayerDefinition object for the first (i.e. 0) sub-layer. Set the ID and Definition values.
  Dim myDefinition As New ESRI.ArcGIS.Client.LayerDefinition
  myDefinition.LayerID = 0
  myDefinition.Definition = TextBox1.Text
  myObservableCollection.Add(myDefinition)
  
  ' Apply the custom LayerDefinition to the ArcGISDynamicMapServiceLayer.
  myArcGISDynamicMapServiceLayer.LayerDefinitions = myObservableCollection
  
  ' Need to invoke the Refresh Method to redraw the sub-layer in the ArcGISDynamicMapServiceLayer.
  myArcGISDynamicMapServiceLayer.Refresh()
  
End Sub

Requirements

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

See Also

© ESRI, Inc. All Rights Reserved.