ArcGIS API for WPF - Library Reference
Url Property
See Also  Example Send comments on this topic
ESRI.ArcGIS.Client Namespace > ArcGISDynamicMapServiceLayer Class : Url Property

Gets or sets the URL to an ArcGISDynamicMapServiceLayer, non-cached (dynamic), map service.

Syntax

Visual Basic (Declaration) 
Public Property Url As String
C# 
public string Url {get; set;}

Example

XAMLCopy Code
<esri:ArcGISDynamicMapServiceLayer ID="DynamicLayer"
    Url="http://serverapps.esri.com/ArcGIS/rest/services/California/MapServer" />
XAMLCopy Code
<StackPanel Name="StackPanel1" Height="400" Width="400" Margin="0,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" >
    <esri:Map Background="White" Name="Map1" Height="200" Width="400">
    
         <!-- Define an ArcGISDynamicMapServiceLayer. -->
         <esri:ArcGISDynamicMapServiceLayer 
              Url="http://serverapps.esri.com/ArcGIS/rest/services/California/MapServer" />
              
    </esri:Map>
    
    <!-- Url Property (Read/Write) -->
    <TextBlock Height="23" Name="TextBlock_Url" Text="{Binding ElementName=Map1, Path=Layers[0].Url}" />
</StackPanel>
C#Copy Code
private void MainPage_Loaded(object sender, System.Windows.RoutedEventArgs e)
{
     
  // Create an ArcGISDynamicServiceLayer. The Map1 object (a Map class) was previously defined in XAML.
  ArcGISDynamicMapServiceLayer myArcGISDynamicMapServiceLayer = new ArcGISDynamicMapServiceLayer();
 
     // Add an ArcGISDynamicMapServiceLayer.
  myArcGISDynamicMapServiceLayer.Url = "http://serverapps.esri.com/ArcGIS/rest/services/California/MapServer";
  myArcGISDynamicMapServiceLayer.ID = "MyUniqueName";
  
  myArcGISDynamicMapServiceLayer.Initialized += new EventHandler<EventArgs>(ArcGISDynamicMapServiceLayer_Initialized);
  Map1.Layers.Add(myArcGISDynamicMapServiceLayer);
  
}
             	
private void ArcGISDynamicMapServiceLayer_Initialized(object sender, System.EventArgs e)
{
             	
  // The TextBlock_Url (a TextBlock object) was defined previously in the XAML.
            
  ArcGISDynamicMapServiceLayer myArcGISDynamicMapServiceLayer = (ArcGISDynamicMapServiceLayer)Map1.Layers["MyUniqueName"];
             	
  // Url Property (Read/Write)
  TextBlock_Url.Text = myArcGISDynamicMapServiceLayer.Url;
  
}
VB.NETCopy Code
Private Sub MainPage_Loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles Me.Loaded
             	
  ' Create an ArcGISDynamicServiceLayer. The Map1 object (a Map class) was previously defined in XAML.
  Dim myArcGISDynamicMapServiceLayer As New ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer
 
     ' Add an ArcGISDynamicMapServiceLayer.
  myArcGISDynamicMapServiceLayer.Url = "http://serverapps.esri.com/ArcGIS/rest/services/California/MapServer"
  myArcGISDynamicMapServiceLayer.ID = "MyUniqueName"
  
  AddHandler myArcGISDynamicMapServiceLayer.Initialized, AddressOf ArcGISDynamicMapServiceLayer_Initialized
  Map1.Layers.Add(myArcGISDynamicMapServiceLayer)
  
End Sub
             	
Private Sub ArcGISDynamicMapServiceLayer_Initialized(ByVal sender As System.Object, ByVal e As System.EventArgs)
             	
  ' The TextBlock_Url (a TextBlock object) was defined previously in the XAML.
     
  Dim myArcGISDynamicMapServiceLayer As ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer = Map1.Layers("MyUniqueName")
             	
  'Url Property (Read/Write)
  TextBlock_Url.Text = myArcGISDynamicMapServiceLayer.Url
             	
End Sub

Remarks

Use the Services Directory application available with REST services on any ArcGIS Server site to discover the URL.

Requirements

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

See Also

© ESRI, Inc. All Rights Reserved.