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

Gets the name (string) of the object ID field associated with an attribute table for ArcGISImageServiceLayer that is based on Mosaic datasets.

Syntax

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

Example

C#Copy Code
private void MainPage_Loaded(object sender, System.Windows.RoutedEventArgs e)
{
  
  // The Map1 object (a Map object) was defined previously in XAML.
  
  // Create an ArcGISImageServiceLayer.
  ESRI.ArcGIS.Client.ArcGISImageServiceLayer myArcGISImageServiceLayer = new ESRI.ArcGIS.Client.ArcGISImageServiceLayer();
  myArcGISImageServiceLayer.Url = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Portland/CascadeLandsat/ImageServer";
            
  // Create an Event Handler.
  myArcGISImageServiceLayer.Initialized += new System.EventHandler<EventArgs>(ArcGISImageServiceLayer_Intialized);
                 
  // Add the ArcGISImageServiceLayer to the LayerCollection of the Map.
  Map1.Layers.Add(myArcGISImageServiceLayer);
                 
}
                 
private void ArcGISImageServiceLayer_Intialized(object sender, EventArgs e)
{
                 
  // The Map1 object (a Map object) and TextBlock_ObjectIdField (a TextBlock object) were defined previously in XAML.
                 
  // Access a specific ArcGISImageServiceLayer.
  ESRI.ArcGIS.Client.ArcGISImageServiceLayer myArcGISImageServiceLayer = (ESRI.ArcGIS.Client.ArcGISImageServiceLayer)Map1.Layers[0];
  
  // ObjectIdField Property (Read Only).
  TextBlock_ObjectIdField.Text = myArcGISImageServiceLayer.ObjectIdField;
                 
}
VB.NETCopy Code
Private Sub MainPage_Loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles Me.Loaded
                 
  ' The Map1 object (a Map object) was defined previously in XAML.
                 
  ' Create an ArcGISImageServiceLayer.
  Dim myArcGISImageServiceLayer As New ESRI.ArcGIS.Client.ArcGISImageServiceLayer
  myArcGISImageServiceLayer.Url = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Portland/CascadeLandsat/ImageServer"
                 
  ' Create an Event Handler.
  AddHandler myArcGISImageServiceLayer.Initialized, AddressOf ArcGISImageServiceLayer_Intialized
                 
  ' Add the ArcGISImageServiceLayer to the LayerCollection of the Map.
  Map1.Layers.Add(myArcGISImageServiceLayer)
                 
End Sub
                 
Private Sub ArcGISImageServiceLayer_Intialized(ByVal sender As Object, ByVal e As EventArgs)
                 
  ' The Map1 object (a Map object) and TextBlock_ObjectIdField (a TextBlock object) were defined previously in XAML.
                 
  ' Access a specific ArcGISImageServiceLayer.
  Dim myArcGISImageServiceLayer As ESRI.ArcGIS.Client.ArcGISImageServiceLayer = Map1.Layers.Item(0)
  
  ' ObjectIdField Property (Read Only).
  TextBlock_ObjectIdField.Text = myArcGISImageServiceLayer.ObjectIdField
                 
End Sub

Remarks

If an ArcGISImageServiceLayer is not a Mosaic dataset there will not be any ArcGISImageServiceLayer.Fields to be obtained and hence only a zero length string is returned for the ObjectID Property. The ObjectID Property always returns a string value and not a Nothing/null. Only ArcGISImageServiceLayer's that are based on Mosaic datasets will return a non-zero length string for the ObjectID Property.

Requirements

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

See Also

© ESRI, Inc. All Rights Reserved.