ArcObjects Library Reference (ArcMapUI)  

IMxDocument Interface

Provides access to members that control the Mx Document.

Product Availability

Available with ArcGIS Desktop.


Read-only property ActivatedView The activated view. This is the same as the active view unless a data frame is activated within a layout.
Read/write property ActiveView The active view.
Read-only property ActiveViewCommand The command associated with the active view.
Method AddLayer Adds a layer to the current focus map.
Method CanInsertObject Indicates if the document allows objects to be inserted.
Read-only property ContentsView The contents view at the specified index.
Read-only property ContentsViewCount The number of contents views in the document.
Read/write property ContextItem The last item that was right-clicked.
Read/write property CurrentContentsView The current contents view of the document.
Read/write property CurrentLocation The current mouse location in map units.
Read/write property DefaultColor The default color for the given type.
Read/write property DefaultTextFont The default font for text.
Read/write property DefaultTextFontSize The default font size for text.
Write-only property DelayUpdateContents Indicates document update notifications should be ignored.
Read-only property FocusMap The current focus map.
Method InsertObject Inserts an object into the document. Displays the insert object dialog.
Read-only property Maps The collection of maps in the document.
Read-only property OperationStack The operation stack.
Read/write property PageLayout The page layout.
Read/write property RelativePaths Indicates if path names are stored relative to the document.
Read-only property SearchTolerance The global search tolerance in geographic units for selection.
Read/write property SearchTolerancePixels The global search tolerance in pixels for selection.
Read-only property SelectedItem The selected item in the layer control.
Read-only property SelectedLayer The selected layer in the layer control.
Read-only property StyleGallery Reference to the document's Style Gallery.
Read-only property TableProperties Table properties, for Layers and Tables in ArcMap.
Method UpdateContents Notifies the document that the contents have been updated.

CoClasses that implement IMxDocument

CoClasses and Classes Description
MxDocument Esri Mx Document.


This interface is a starting point for much of the other objects in ArcMap.  For example, this interface provides access to the current active view, the currently selected map, all of the maps, and the style gallery.  This interface also has many properties reflected in the running application including: the text font, the text size, and the search tolerance.  Almost every ArcMap customization uses IMxDocument one way or another.

Obtain a reference to this interface via IApplication::Document.

To edit the contents of a map document saved to a file (*.mxd) outside of an ArcMap session or without instantiating a new Application (ArcMap process), see IMapDocument.  IMapDocument provides the ability to edit and save the contents of a map document.


.NET Snippets

Get Contents View from ArcMap | Get MxDocument from ArcMap | Zoom to Active Layer in TOC | Get MxApplication from ArcMap | TimeControl Playback | Set Data Source | Get PageLayout from ArcMap | Open StyleManagerDialog | Get Map from ArcMap | Open StyleReferencesDialog | Get ActiveView from ArcMap

.NET Samples

Curve conversion add-in (Code Files: CurveConversionDockWin) | Add a custom menu created in .NET to ArcGIS for Desktop (Code Files: AddShapefile) | Publish a map (Code Files: PublishMap) | Make a custom time slider (Code Files: CustomTimeSliderButton) | ViperPin tool (Code Files: ViperPinForm) | Selection restriction evaluator (Code Files: SelectionRestrictionEvaluator) | Custom UI elements using add-ins (Code Files: ZoomToLayerButton) | Implementing a schematic digitizing tool (Code Files: DigitTool) | Implementing an XML builder external component (Code Files: XMLDocImpl) | Generate a report (Code Files: ExportReport) | Applying a time offset to a time-aware feature layer (Code Files: TimeOffsetButton) | Brushing to create a selection (Code Files: BrushingVB) | Layer filtering TOC view (Code Files: TOCLayerFilter) | Set the time extents for a layer then render the layer (Code Files: SetTimeExtentsButton) | ArcGIS Network Analyst extension barrier location editor (Code Files: EditorForm) | Subset network evaluators (Code Files: AutoUpdateNetworkElementArrayParametersCommand) | Custom subtyped command and tool (Code Files: PolyFeedbackTools) | StreetMap routing (Code Files: RoutingForm) | Create a command by inheriting from BaseCommand (Code Files: ZoomToLayer) | Create a custom tool (Code Files: DrawGraphicLine) | Custom selection extension (Code Files: SelectByLineTool) | Create a custom selection extension by extending ArcObjects (Code Files: SelectByLineTool SelectionExtension SelectionTargetComboBox ZoomToLayerMultiItem) | Schematic diagram auto refresh (Code Files: FormAutorefresh) | Custom feedback tool and font drop-down list tool control (Code Files: FontToolControl ToolSample) | Migrating from VB6 to VB .NET for ArcGIS 10 (Code Files: clscopy_table_sel) | Time Series Graph tool add-in (Code Files: TimeSeriesGraph)

.NET Related Topics

Accessing application and document objects | Adjusting feature locations with spatial adjustment | ArcMapUI | Create a command by inheriting from BaseCommand | Create a custom tool | DisplayUI | How to create AOIs and bookmarks | How to load data into a network analysis problem | How to wire custom events using IActiveViewEvents | LocationUI | Migrating VB6 to VB.NET for ArcGIS 10 | Performing basic map functions | SystemUI