This document is archived and information here might be outdated.  Recommended version.


IMxDocument.ActiveView Property (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > ArcMapUI > ESRI.ArcGIS.ArcMapUI > Interfaces > IM > IMxDocument Interface > IMxDocument.ActiveView Property
ArcGIS Developer Help

IMxDocument.ActiveView Property

The active view.

[Visual Basic .NET]
Public Property ActiveView As IActiveView
[C#]
public IActiveView ActiveView {get; set;}

Product Availability

Available with ArcGIS Desktop.

Remarks

This method provides access to the active view.  ArcMap currently supports two types of views, layout view and data view; the view with focus is the active view.   If ArcMap is in layout view, this property returns an IActiveView reference to the PageLayout object.  Alternatively, if ArcMap is in data view, the returned IActiveView reference is to a Map object.  Both the PageLayout and Map objects implement the IActiveView interface.

Note, an ArcMap document may have multiple maps (data frames) in it.  Multiple maps means multiple Map objects.  Any Map in this collection may be set as the active view.  There is typically only one PageLayout object per session of ArcMap.

To determine if the returned reference is to a PageLayout object or a Map, attempt a query interface (QI) to either IPageLayout or IMap.  If you know you want a reference to the focus map, use IMxDocument::FocusMap instead.  Similarly, if you know you want a reference to the page layout, use IMxDocument::PageLayout instead.  This is often the case when you need to refresh the display.  For example, if someone has panned the map and you now need to refresh it, explicitly use IMxDocument::FocusMap which returns a reference to the Map with focus, and then QI for IActiveView.

Use this property to also set the active view programmatically.


See Also

IMxDocument Interface | IActiveView Interface

.NET Samples

Create a custom tool Custom UI elements using add-ins ArcGIS Network Analyst extension barrier location editor Create a custom selection extension by extending ArcObjects Create a custom selection extension by extending ArcObjects ViperPin tool