Click or drag to resize
ArcGISDynamicMapServiceLayer Class
Dynamic ArcGIS REST map service layer.
Inheritance Hierarchy

Namespace: Esri.ArcGISRuntime.Layers
Assembly: Esri.ArcGISRuntime (in Esri.ArcGISRuntime.dll) Version: 10.2.7.0 (10.2.7.1234)
Syntax
public sealed class ArcGISDynamicMapServiceLayer : DynamicLayer, 
	IQueryCopyright, ICopyright, ILegendSupport

The ArcGISDynamicMapServiceLayer type exposes the following members.

Constructors
  NameDescription
Public methodArcGISDynamicMapServiceLayer
Initializes a new instance of the ArcGISDynamicMapServiceLayer class.
Public methodArcGISDynamicMapServiceLayer(Uri)
Initializes a new instance of the ArcGISDynamicMapServiceLayer class.
Top
Methods
  NameDescription
Public methodCheckAccess
Determines whether the calling thread has access to this DispatcherObject.
(Inherited from DispatcherObject.)
Public methodClearValue(DependencyProperty)
Clears the local value of a property. The property to be cleared is specified by a DependencyProperty identifier.
(Inherited from DependencyObject.)
Public methodClearValue(DependencyPropertyKey)
Clears the local value of a read-only property. The property to be cleared is specified by a DependencyPropertyKey.
(Inherited from DependencyObject.)
Public methodCoerceValue
Coerces the value of the specified dependency property. This is accomplished by invoking any CoerceValueCallback function specified in property metadata for the dependency property as it exists on the calling DependencyObject.
(Inherited from DependencyObject.)
Public methodCode exampleCreateDynamicLayerInfosFromLayerInfos
Builds a set of DynamicLayerInfo instances based on the current set of LayerInfo instances.
Public methodEquals
Determines whether a provided DependencyObject is equivalent to the current DependencyObject.
(Inherited from DependencyObject.)
Protected methodFinalize
Finalizes an instance of the ArcGISDynamicMapServiceLayer class.
(Overrides ObjectFinalize.)
Public methodGetAllDetailsAsync
Gets detailed metadata information about all layers available in the service.
Public methodGetDetailsAsync
Gets detailed metadata information about the specified layer or table available in the service.
Public methodGetHashCode
Gets a hash code for this DependencyObject.
(Inherited from DependencyObject.)
Protected methodGetImageAsync
Gets the image data for a given area.
(Overrides DynamicLayerGetImageAsync(DynamicLayerImageParameters, CancellationToken).)
Public methodGetLocalValueEnumerator
Creates a specialized enumerator for determining which dependency properties have locally set values on this DependencyObject.
(Inherited from DependencyObject.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodGetValue
Returns the current effective value of a dependency property on this instance of a DependencyObject.
(Inherited from DependencyObject.)
Public methodCode exampleInitializeAsync
Loads the metadata for this layer based on the current configuration.
(Inherited from Layer.)
Public methodInvalidate
Causes a refresh of the layer.
(Inherited from DynamicLayer.)
Public methodInvalidateProperty
Re-evaluates the effective value for the specified dependency property
(Inherited from DependencyObject.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Protected methodOnInitializeDynamicLayerRequestedAsync
Override this method to initialize any properties and settings prior to using the map.
(Overrides DynamicLayerOnInitializeDynamicLayerRequestedAsync.)
Protected methodOnPropertyChanged(DependencyPropertyChangedEventArgs)
Invoked whenever the effective value of any dependency property on this DependencyObject has been updated. The specific dependency property that changed is reported in the event data.
(Inherited from DependencyObject.)
Protected methodOnPropertyChanged(String)
Notifies listeners that a property value has changed.
(Inherited from Layer.)
Public methodReadLocalValue
Returns the local value of a dependency property, if it exists.
(Inherited from DependencyObject.)
Public methodSetCurrentValue
Sets the value of a dependency property without changing its value source.
(Inherited from DependencyObject.)
Protected methodSetLayerInitializationFailed
status must be failed - if not throw
(Inherited from Layer.)
Protected methodSetLayerStatus
Status cannot be failed or it will throw. To set Status to LayerStatus.Failed, call SetLayerInitializationFailed.
(Inherited from Layer.)
Public methodSetValue(DependencyProperty, Object)
Sets the local value of a dependency property, specified by its dependency property identifier.
(Inherited from DependencyObject.)
Public methodSetValue(DependencyPropertyKey, Object)
Sets the local value of a read-only dependency property, specified by the DependencyPropertyKey identifier of the dependency property.
(Inherited from DependencyObject.)
Protected methodShouldSerializeProperty
Returns a value that indicates whether serialization processes should serialize the value for the provided dependency property.
(Inherited from DependencyObject.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodVerifyAccess
Enforces that the calling thread has access to this DispatcherObject.
(Inherited from DispatcherObject.)
Top
Fields
  NameDescription
Public fieldStatic memberGeodatabaseVersionProperty
Identifies the GeodatabaseVersion Dependency Property
Public fieldStatic memberImageFormatProperty
Identifies the ImageFormat Dependency Property
Public fieldStatic memberServiceUriProperty
Identifies the ServiceUri dependency property.
Public fieldStatic memberTokenProperty
Identifies the Token dependency property.
Top
Properties
  NameDescription
Public propertyBrightness
Gets or sets layer brightness level.
(Inherited from DynamicLayer.)
Public propertyContrast
Gets or sets layer contrast level.
(Inherited from DynamicLayer.)
Public propertyDefaultSpatialReference
Gets the default spatial reference.
(Inherited from Layer.)
Public propertyDependencyObjectType
Gets the DependencyObjectType that wraps the CLR type of this instance. 
(Inherited from DependencyObject.)
Public propertyDispatcher
Gets the Dispatcher this DispatcherObject is associated with.
(Inherited from DispatcherObject.)
Public propertyDisplayName
Gets or sets the display name.
(Inherited from Layer.)
Public propertyCode exampleDynamicLayerInfos
Gets or sets the dynamic layer infos.
Public propertyFullExtent
Gets the full extent of the layer in it's default spatial reference.
(Inherited from Layer.)
Public propertyGamma
Gets or sets layer gamma level.
(Inherited from DynamicLayer.)
Public propertyGeodatabaseVersion
Gets or sets the Geodatabase version.
Public propertyID
Gets or sets an ID associated with this layer.
(Inherited from Layer.)
Public propertyCode exampleImageFormat
Gets or sets the image format.
Public propertyInitializationException
Gets the initialization exception.
(Inherited from Layer.)
Public propertyIsSealed
Gets a value that indicates whether this instance is currently sealed (read-only).
(Inherited from DependencyObject.)
Public propertyIsVisible
Gets or sets the layer visibility.
(Inherited from Layer.)
Public propertyCode exampleLayerDefinitions
Gets or sets the layer definitions.
Public propertyCode exampleLayerDrawingOptions
Gets or sets the layer drawing options.
Public propertyLayerTimeOptions
Gets or sets the layer time options.
Public propertyMaxScale
Gets or sets the maximum scale to display this layer at. A small number allows the map to display the layer when zooming further in.
(Inherited from Layer.)
Public propertyMinScale
Gets or sets the minimum scale to render this layer at. A large number allows the map to display the layer when zooming further out.
(Inherited from Layer.)
Public propertyOpacity
Gets or sets the opacity.
(Inherited from Layer.)
Public propertyServiceInfo
Service metadata
Public propertyCode exampleServiceUri
Gets or sets the endpoint of the map service.
Public propertyShowLegend
Gets or sets a value indicating whether this layer should show in a legend
(Inherited from Layer.)
Public propertyStatus
The Layer's Status, indicating whether it is being/has been initialized, or initialization failed.
(Inherited from Layer.)
Public propertyToken
Gets or sets the token used to access a secure ArcGIS service.
Public propertyCode exampleVisibleLayers
Gets or sets the sub-layers that are visible in an ArcGISDynamicMapServiceLayer.
Top
Events
  NameDescription
Public eventLegendChanged
Occurs when the legend of the layer changed.
Public eventPropertyChanged
Occurs when a property value changes.
(Inherited from Layer.)
Top
Remarks

An ArcGISDynamicMapServiceLayer is a dynamic map service published by ArcGIS Server (version 9.3 and higher) using REST. An ArcGISDynamicMapServiceLayer has the following characteristics:

Examples

Shows creating an ArcGISDynamicMapServiceLayer in XAML and via code-behind. The ArcGISDynamicMapServiceLayer.InitializeAsync Method is used to obtain metadata about the layer (i.e. ID and Copyright) using the Async/Task framework.

Code example using the ArcGISDynamicMapServiceLayer Class.

XAML
<Window x:Class="ArcGISDynamicMapServiceLayerXamlAndCodeBehind.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="600" Width="800"
    xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013">

    <Grid>
        <StackPanel Orientation="Vertical">
            <StackPanel Orientation="Vertical">

                <!-- TextBlock to provide the instructions on how to use the sample code. It will be 
                populated with instructions in the code-behind when the application loads. -->
                <TextBlock Height="174" HorizontalAlignment="Left" Name="TextBlock1" VerticalAlignment="Top" 
                           Width="770" TextWrapping="Wrap"  Margin="10,2,0,0" />

            </StackPanel>
            <StackPanel Orientation="Vertical">

                <!-- Button to add an ArcGISDynamicMapServiceLayer via code-behind. -->
                <Button Content="Add another ArcGISDynamicMapServiceLayer (via code-behind) for the specified Url." 
                        x:Name="Button1" Click="Button1_Click" Width="780" HorizontalAlignment="Left"/>

            </StackPanel>
            <StackPanel Orientation="Horizontal">

                <!-- A MapView Control to display various GIS layers. -->
                <esri:MapView x:Name="MapView1" Width="400" Height="300" VerticalAlignment="Top" Margin="2,2,2,2">

                    <!-- A Map. -->
                    <esri:Map  x:Name="Map1" >

                        <!-- Add an ArcGISDynamicMapServiceLayer via Xaml. Set the ID and ImageFormat properties. -->
                        <esri:ArcGISDynamicMapServiceLayer ID="World_Light_Gray_Base" ImageFormat="PNG24" 
                          ServiceUri="http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer"/>
                    </esri:Map>
                </esri:MapView>

                <StackPanel Orientation="Vertical">

                    <!-- TextBox to display information about the various layers in the Map. -->
                    <TextBox x:Name="TextBox1" TextWrapping="Wrap" Height="300" Width="370" Margin="2,2,2,2"/>

                </StackPanel>

            </StackPanel>
        </StackPanel>
    </Grid>

</Window>

SPECIAL NOTE: The XAML displayed above comes from a C# project. If you are a VB.NET developer, you will need to modify the text for the x:Class namespace from "ArcGISDynamicMapServiceLayerXamlAndCodeBehind.MainWindow" to be just "MainWindow".

namespace ArcGISDynamicMapServiceLayerXamlAndCodeBehind
{
    public partial class MainWindow : System.Windows.Window
    {
        public MainWindow()
        {
            // This call is required by the designer.
            InitializeComponent();

            // Add any initialization after the InitializeComponent() call.

            // Provide instructions on how to use the sample. 
            TextBlock1.Text = "When the application loads an ArcGISDynamicMapServiceLayer will " + 
                "automatically be added to the Map (it was specified in XAML). Click the Button to add another" + 
                "ArcGISDynaicMapServiceLayer to the Map (it will be added via code-behind). The ID  and copyright " + 
                "information of each layer will displayed in the TextBox.";

            // Create a Geometry based on an Envelope set to a particular extent of North and Central America using a WebMercator Spatial Reference.
            Esri.ArcGISRuntime.Geometry.Geometry myGeometry = new Esri.ArcGISRuntime.Geometry.Envelope(-20686341, 712444, -5228835, 12734949, Esri.ArcGISRuntime.Geometry.SpatialReferences.WebMercator);

            // Set the initial extent of the Map using the InitialViewpoint Property to that of our Geometry.
            MapView1.Map.InitialViewpoint = new Esri.ArcGISRuntime.Controls.Viewpoint(myGeometry);
            // Call our custom 'async' function to display information about the ArcGISDynamicMapSericeLayer that was added in XAML.
            Init();
        }

        public async void Init()
        {
            // This function will display information about the ArcGISDynamicMapServiceLayer that was added in XAML.

            // Get the ArcGISDynamicMapServiceLayer by it's index number.        
            Esri.ArcGISRuntime.Layers.ArcGISDynamicMapServiceLayer myArcGISDynamicMapServiceLayer = 
                (Esri.ArcGISRuntime.Layers.ArcGISDynamicMapServiceLayer) MapView1.Map.Layers[0];

            // Initialize the ArcGISDynamicMapServiceLayer which allows for obtain various Property information.
            await myArcGISDynamicMapServiceLayer.InitializeAsync();

            // Get the ID of the ArcGISDynamicMapServiceLayer.
            string myID = myArcGISDynamicMapServiceLayer.ID;

            // Create a StringBuilder object to hold information about the ArcGISDynamicMapServiceLayer.
            System.Text.StringBuilder myStringBuilder = new System.Text.StringBuilder();

            // Add the ID of the ArcGISDynamicMapServiceLayer to the StringBuilder.
            myStringBuilder.Append("The 1st ArcGISDynamicMapServiceLayer was added via XAML and it's ID is: " + myID + System.Environment.NewLine);

            // Get the MapServiceInfo details about the ArcGISDynamicMapServiceLayer.
            Esri.ArcGISRuntime.ArcGISServices.MapServiceInfo myMapServiceInfo = myArcGISDynamicMapServiceLayer.ServiceInfo;

            // Get the copyright information about the ArcGISDynamicMapServiceLayer and add to the StringBuilder.
            string myCopyright = myMapServiceInfo.CopyrightText;
            myStringBuilder.Append(myCopyright + System.Environment.NewLine);

            // Display the results of the StringBuilder text to the user.
            TextBox1.Text = myStringBuilder.ToString();
        }

        private async void Button1_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            // This function will add an ArcGISDynamicMapServiceLayer to the Map via code behind.

            // Create a new Uri that point to an ArcGISDynamicMapServiceLayer.
            System.Uri myUri = new System.Uri("http://services.arcgisonline.com/ArcGIS/rest/services/Demographics/USA_Unemployment_Rate/MapServer");

            // Create a new instance of an ArcGISDynamicMapServiceLayer.
            Esri.ArcGISRuntime.Layers.ArcGISDynamicMapServiceLayer myArcGISDynamicMapServiceLayer = null;
            myArcGISDynamicMapServiceLayer = new Esri.ArcGISRuntime.Layers.ArcGISDynamicMapServiceLayer();

            // Set the Uri and ID of the ArcGISDynamicMapSericveLayer.
            myArcGISDynamicMapServiceLayer.ServiceUri = myUri.ToString();
            myArcGISDynamicMapServiceLayer.ID = "MyArcGISDynamicMapServiceLayer";

            // For better image quality set the ImageFormat to be PNG24 (the Default is PNG8)
            myArcGISDynamicMapServiceLayer.ImageFormat = Esri.ArcGISRuntime.ArcGISServices.ImageFormat.PNG24;

            // Add the ArcGISDynamicMapServiceLayer to the Map.
            MapView1.Map.Layers.Add(myArcGISDynamicMapServiceLayer);

            // Initialize the ArcGISDynamicMapServiceLayer which allows for obtain various Property information.
            await myArcGISDynamicMapServiceLayer.InitializeAsync();

            // Get the ID of the ArcGISDynamicMapServiceLayer.
            string myID = myArcGISDynamicMapServiceLayer.ID;

            // Create a StringBuilder object to hold information about the ArcGISDynamicMapServiceLayer.
            System.Text.StringBuilder myStringBuilder = new System.Text.StringBuilder();
            myStringBuilder.Append(TextBox1.Text + System.Environment.NewLine);
            myStringBuilder.Append(System.Environment.NewLine);

            // Add the ID of the ArcGISDynamicMapServiceLayer to the StringBuilder.
            myStringBuilder.Append("The 2nd ArcGISDynamicMapServiceLayer was added via code-behind and it's ID is: " + 
                myID + System.Environment.NewLine);

            // Get the MapServiceInfo details about the ArcGISDynamicMapServiceLayer.
            Esri.ArcGISRuntime.ArcGISServices.MapServiceInfo myMapServiceInfo = myArcGISDynamicMapServiceLayer.ServiceInfo;

            // Get the copyright information about the ArcGISDynamicMapServiceLayer and add to the StringBuilder.
            string myCopyright = myMapServiceInfo.CopyrightText;
            myStringBuilder.Append(myCopyright + System.Environment.NewLine);

            // Display the results of the StringBuilder text to the user.
            TextBox1.Text = myStringBuilder.ToString();
        }
    }
}
See Also
Supported Platforms
This type is supported on the following ArcGIS Runtime .NET SDK platforms:
Windows Desktop
Windows Phone
Windows Store
Additional Examples
Hyperlink to ExampleDescription
AllLayersServiceInfo_FeatureServiceLayerInfoDemonstrates getting detailed ArcGIS Server MapServer metadata for various ArcGISDynamicMapServiceLayer and ArcGISTiledMapServiceLayer web services.
ArcGISDynamicMapServiceLayerShows creating an ArcGISDynamicMapServiceLayer in XAML and defining the serviceUri property for the layer.
ArcGISDynamicMapServiceLayer_GetDetailsShows adding an ArcGISDynamicMapServiceLayer with a LayerDefinition applied (discovered by the ArcGISDynamicMapServiceLayer.GetDetailsAsync Method) and then modifying the LayerDefinition to change the features returned.
ArcGISDynamicMapServiceLayer_VisibleLayersShows obtaining which sub-layers are visible using the ArcGISDynamicMapServiceLayer.GetAllDetailsAsync Method. Then the user can interact with application and change the VisibleLayers of the ArcGISDynamicMapServiceLayer.
ArcGISDynamicMapServiceLayerImageFormatShows changing the return ImageFormat for ArcGISDynamicMapServiceLayer and how that appears visually in the Map.
ArcGISDynamicMapServiceLayerXamlAndCodeBehindShows creating an ArcGISDynamicMapServiceLayer in XAML and via code-behind. The ArcGISDynamicMapServiceLayer.InitializeAsync Method is used to obtain metadata about the layer (i.e. ID and Copyright) using the Async/Task framework.
Camera_PropertiesShows adjusting the Camera Properties of a SceneView to view different perspectives of data on the Earth.
Camera_SetMethodsDemonstrates navigating/animating between MapPoint Graphics with a Camera. Simultaneous changes of X, Y, Z, Pitch, and Heading during the animation is shown.
CreateDynamicLayerInfosFromLayerInfosDemonstrates applying a custom rendering via XAML using the Dynamic Layer option of an ArcGISDynamicMapServiceLayer. Also, shows how to use the ArcGISDynamicMapServiceLayer.CreateDynamicLayerInfosFromLayerInfos Method to obtain the original rendering of the layer that was defined in the map service. The CreateDynamicLayerInfosFromLayerInfos is then used to reset the layer back to orignal rendering.
DynamicLayerInfoCollectionDemonstrates using various Renderers on a Dynamic Layer when the 'WorkspaceID' and 'DataSourceName' are known using a TableDataSource.
DynamicLayerInfosDemonstrates using various Renderers on a Dynamic Layer (via XAML and code-behind) when the 'WorkspaceID' and 'DataSourceName' are known using a TableDataSource.
FeatureServiceLayerInfo_CopyrightTextDemonstrates using the GetDetailsAsync Method to obtain the FeatureServiceLayerInfo.CopyrightText on an ArcGISDynamicMapServiceLayer.
IdentifyParameter_DynamicLayerInfosDemonstrates performing an Identify on a Dynamic Layer using the ESRI.ArcGISRuntime.Tasks.Query.IdentifyParameter.DynamicLayerInfos Property.
IdentifyTaskDemonstrates using the Query.IdentifyTask operation find a feature based upon it's geographic position in an ArcGIS Server map service and display it as a graphic in a GraphicsLayer.
LayerCollectionDemonstrates the work-flow of creating a layer dynamically via code-behind. The process of a layer: (1) initializing, (2) determining when initialization is complete, and (3) error trapping for bad initialization is described in detail.
LayerDefinitionsDemonstrates setting numerous LayerDefinitions values on an ArcGISDynamicMapServiceLayer and visualizing the impact of the features being returned in the Map.
LayerDefinitionsSimpleDemonstrates setting the LayerDefinitions Property of an ArcGISDynamicMapServiceLayer where two sub-layers are present. One sub-layer has the LayerDefinition set in XAML and the other sub-layer has it's LayerDefinition set via code-behind.
LayerDrawingOptionCollectionDemonstrates using the existing rendering of a Dynamic Layer sub-layer of an ArcGISDynamicMapServiceLayer and switching to a custom rendering defined in code-behind for the Dynamic Layer.
LayerDrawingOptionsDemonstrates changing the rendering of the first sub-layer of an ArcGISDynamicMapServiceLayer using the Dynamic Layer capabilities of ArcGIS Server 10.1 and higher.
MapServiceInfo_DocumentInfo_LayerServiceInfoDemonstrates getting detailed ArcGIS Server MapServer metadata to obtain MapServiceInfo data for various ArcGISDynamicMapServiceLayer and ArcGISTiledMapServiceLayer web services.
MapView_SpatialReferenceDemonstrates reseting the MapView.SpatialReference by setting it to a new Map.
MultipleMapsInMapViewDemonstrates switching out different Map objects (with different layers) for the MapView.Map Property.
QueryTableDataSourceDemonstrates adding a Dynamic Layer via code-behind using a QueryTableDataSource.