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

onCompleted
The method to call when details of the sub-layer or table is retrieved.
Gets all details for sub-layers or tables.

Syntax

Visual Basic (Declaration) 
Public Sub GetAllDetails( _
   ByVal onCompleted As Action(Of IDictionary(Of Integer,FeatureLayerInfo),Exception) _
) 

Remarks

The GetAllDetails Method returns a Dictionary of FeatureLayerInfo objects. 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 a specific sub-layer in an ArcGISDynamicMapServiceLayer consider using the ArcGISDynamicMapServiceLayer.GetDetails 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

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 with several sub-layers will be display. Some of the sub-layers have LayerDefinition values specified which restrict how many features are returned in the Map. Click you cursor in the TextBoxes for the various sub-layer LayerDefinitions and modify them. Then click the Button to see the changes. If you type a bogus LayerDefintion in the TextBox for a sub-layer, it will not return any features for that sub-layer. Use the "1=1" to return all features for a 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 LayerDefintions 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="13411142,393465,13413308,394583">
  
   <!-- Add an ArcGISDynamicMapServiceLayer. Wire up an Initialized Event to give back the LayerDefinitions
   for the individual sub-layers 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="155" HorizontalAlignment="Left" Margin="0,150,0,0" 
          Name="Button_ApplyNewLayerDefinition" VerticalAlignment="Top" Width="184" Click="Button_ApplyNewLayerDefinition_Click"/>
  
  <!-- Add a ListBox to display all of the LayerDefinitions for each sub-layer. Embedded in each row of
  the Listbox will be a TextBoxes (one for each sub-layer) that user can make edits and then click the
  apply button.-->
  <ListBox Height="155" HorizontalAlignment="Left" Margin="190,150,0,0" Name="ListBox1" VerticalAlignment="Top" 
           Width="433" />
  
  <!-- Provide the instructions on how to use the sample code. -->
  <TextBlock Height="144" HorizontalAlignment="Left" Name="TextBlock1" VerticalAlignment="Top" Width="756" TextWrapping="Wrap" 
       Text="When the application loads an ArcGISDynamicMapServiceLayer with several sub-layers will be display. Some
             of the sub-layers have LayerDefinition values specified which restrict how many features are returned in the
             Map. Click you cursor in the TextBoxes for the various sub-layer LayerDefinitions and modify them. Then 
             click the Button to see the changes. If you type a bogus LayerDefintion in the TextBox for a sub-layer, 
             it will not return any features for that sub-layer. Use the '1=1' to return all features for a sub-layer." />
  
</Grid>
C#Copy Code
private void ArcGISDynamicMapServiceLayer_Initialized(object sender, System.EventArgs e)
{
  // When the ArcGISDynamicMapServiceLayer Initializes get the LayerDefinition expressions for each sub-layer.
  // It is necessary to use the ArcGISDynamicMapServiceLayer.GetAllDetails Method to obtain the LayerDefintions
  // for each 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"));
  
  myArcGISDynamicMapServiceLayer.GetAllDetails((IDictionary<int, ESRI.ArcGIS.Client.FeatureService.FeatureLayerInfo> myDictionaryOfFeatureLayerInfo, Exception myException) => 
          {
  										// Make sure we do not have an error. 
  										if (myException == null)
  										{
  										 // Loop through the Dictionary for each FeatureLayerInfo object.
  										 foreach (var myFeatureLayerInfo in myDictionaryOfFeatureLayerInfo)
  										 {
  										  // Get the sub-layer ID value.
  										  int myID = myFeatureLayerInfo.Value.Id;
              
  										  // Get the sub-layer LayerDefintion value.
  										  string myDefinitionExpression = myFeatureLayerInfo.Value.DefinitionExpression;
              
  										  // Create a StackPanel to hold multiple Framework Element Controls. 
  										  StackPanel myStackPanel = new StackPanel();
  										  myStackPanel.Orientation = Orientation.Horizontal;
              
  										  // Create a TextBlock to hold information about the sub-layer ID.
  										  TextBlock myTextBlock = new TextBlock();
  										  myTextBlock.Text = "LayerID:" + myID.ToString() + "   ";
  										  myStackPanel.Children.Add(myTextBlock);
              
  										  // Create a TextBlock to hold readability information.
  										  TextBlock mytextBlock2 = new TextBlock();
  										  mytextBlock2.Text = "DefinitionExpression: ";
  										  myStackPanel.Children.Add(mytextBlock2);
              
  										  // Create an editable TextBox to display the sub-layer LayerDefintion. 
  										  // Note: the sub-layer ID is embedded as the .Tag for the TextBox. 
  										  TextBox myTextBox = new TextBox();
  										  myTextBox.Tag = myID;
  										  myTextBox.Text = myDefinitionExpression;
  										  myStackPanel.Children.Add(myTextBox);
              
  										  // Add the StackPanel into the ListBox.
  										  ListBox1.Items.Add(myStackPanel);
  										 }
  										}
  									   });
}
            
private void Button_ApplyNewLayerDefinition_Click(object sender, System.Windows.RoutedEventArgs e)
{
  // This function will apply the user changes to the sub-layer LayerDefintions 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>();
  
  // Loop through each StackPanel in the ListBox.
  foreach (StackPanel myStackPanel in ListBox1.Items)
  {
   // Get the text which holds the sub-layer LayerDefinition values.
   TextBox myTextBox = (TextBox)(myStackPanel.Children[2]);
    
   // Create a new LayerDefinition object (one for each sub-layer). Set the ID and Definition values.
   ESRI.ArcGIS.Client.LayerDefinition myDefinition = new ESRI.ArcGIS.Client.LayerDefinition();
   myDefinition.LayerID = Convert.ToInt32(myTextBox.Tag);
   myDefinition.Definition = myTextBox.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 expressions for each sub-layer.
  ' It is necessary to use the ArcGISDynamicMapServiceLayer.GetAllDetails Method to obtain the LayerDefintions
  ' for each 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)
  
  myArcGISDynamicMapServiceLayer.GetAllDetails(Sub(myDictionaryOfFeatureLayerInfo As IDictionary(Of Integer, ESRI.ArcGIS.Client.FeatureService.FeatureLayerInfo), myException As Exception)
  
                                                ' Make sure we do not have an error. 
                                                If myException Is Nothing Then
                                                  
                                                 ' Loop through the Dictionary for each FeatureLayerInfo object.
                                                 For Each myFeatureLayerInfo In myDictionaryOfFeatureLayerInfo
                                                   
                                                  ' Get the sub-layer ID value.
                                                  Dim myID As Integer = myFeatureLayerInfo.Value.Id
                                                  
                                                  ' Get the sub-layer LayerDefintion value.
                                                  Dim myDefinitionExpression As String = myFeatureLayerInfo.Value.DefinitionExpression
                                                   
                                                  ' Create a StackPanel to hold multiple Framework Element Controls. 
                                                  Dim myStackPanel As New StackPanel
                                                  myStackPanel.Orientation = Orientation.Horizontal
                                                  
                                                  ' Create a TextBlock to hold information about the sub-layer ID.
                                                  Dim myTextBlock As New TextBlock
                                                  myTextBlock.Text = "LayerID:" + myID.ToString + "   "
                                                  myStackPanel.Children.Add(myTextBlock)
                                                  
                                                  ' Create a TextBlock to hold readability information.
                                                  Dim mytextBlock2 As New TextBlock
                                                  mytextBlock2.Text = "DefinitionExpression: "
                                                  myStackPanel.Children.Add(mytextBlock2)
                                                  
                                                  ' Create an editable TextBox to display the sub-layer LayerDefintion. 
                                                  ' Note: the sub-layer ID is embedded as the .Tag for the TextBox. 
                                                  Dim myTextBox As New TextBox
                                                  myTextBox.Tag = myID
                                                  myTextBox.Text = myDefinitionExpression
                                                  myStackPanel.Children.Add(myTextBox)
                                                    
                                                  ' Add the StackPanel into the ListBox.
                                                  ListBox1.Items.Add(myStackPanel)
                                                      
                                                 Next myFeatureLayerInfo
                                                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 LayerDefintions 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)
  
  ' Loop through each StackPanel in the ListBox.
  For Each myStackPanel As StackPanel In ListBox1.Items
    
   ' Get the text which holds the sub-layer LayerDefinition values.
   Dim myTextBox As TextBox = CType(myStackPanel.Children.Item(2), TextBox)
   
   ' Create a new LayerDefinition object (one for each sub-layer). Set the ID and Definition values.
   Dim myDefinition As New ESRI.ArcGIS.Client.LayerDefinition
   myDefinition.LayerID = CInt(myTextBox.Tag)
   myDefinition.Definition = myTextBox.Text
   myObservableCollection.Add(myDefinition)
   
  Next
  
  ' 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, Windows 8

See Also

© ESRI, Inc. All Rights Reserved.