AnsweredAssumed Answered

Open a mxd file without a WPF control in 10.3

Question asked by mark.oberg on Jan 29, 2015
Latest reply on Feb 2, 2015 by MBranscomb-esristaff

How do I open a mxd file to read names of the feature layers without a WPF control?  In previous versions I used the ESRI.ArcGIS.Carto.MapDocumentClass to open the mxd then looped thru the feature layers using the ESRI.ArcGIS.Carto.IFeatureLayer guid.

Example code (VB.NET):


Dim objMap As ESRI.ArcGIS.Carto.IMapDocument = New ESRI.ArcGIS.Carto.MapDocumentClass



Dim pUID As ESRI.ArcGIS.esriSystem.UID = New ESRI.ArcGIS.esriSystem.UID

pUID.Value = "{" & GetType(ESRI.ArcGIS.Carto.IFeatureLayer).GUID.ToString & "}"

Dim objLayers As ESRI.ArcGIS.Carto.IEnumLayer = objMap.ActiveView.FocusMap.Layers(pUID, True)


Dim objGenericLayer As ESRI.ArcGIS.Carto.ILayer = objLayers.Next

Do While objGenericLayer IsNot Nothing

If TypeOf objGenericLayer Is ESRI.ArcGIS.Carto.IFeatureLayer Then

Dim objLayer As ESRI.ArcGIS.Carto.IFeatureLayer = CType(objGenericLayer, ESRI.ArcGIS.Carto.IFeatureLayer)

If objLayer.Selectable And objLayer.Visible Then

' Do Something with the selectable and visible feature layer

End If

End If

objGenericLayer = objLayers.Next