ArcGIS Pro 2.6 API Reference Guide
CreateMapFrame(ILayoutElementContainer,Envelope,Map) Method
Example 

ArcGIS.Desktop.Layouts Namespace > IElementFactory Interface > CreateMapFrame Method : CreateMapFrame(ILayoutElementContainer,Envelope,Map) Method
Layout or GroupElement
Envelope
Map
Creates a map frame element on a layout from an envelope geometry. This method must be called on the MCT. Use QueuedTask.Run.
Syntax
Overloads Function CreateMapFrame( _
   ByVal elementContainer As ILayoutElementContainer, _
   ByVal envelope As Envelope, _
   Optional ByVal map As Map _
) As MapFrame

Parameters

elementContainer
Layout or GroupElement
envelope
Envelope
map
Map

Return Value

Returns a MapFrame.
Exceptions
ExceptionDescription
This method or property must be called within the lambda passed to QueuedTask.Run.
Remarks
If the element container is a Layout then the element gets added to the root level of the layout TOC at the top most position. If the element container is a GroupElement then it gets added to the group at the topmost position.
Example
//Create a map frame and set its camera by zooming to the extent of an existing bookmark.

//Construct on the worker thread
await QueuedTask.Run(() =>
{
  //Build 2D envelope geometry
  Coordinate2D mf_ll = new Coordinate2D(6.0, 8.5);
  Coordinate2D mf_ur = new Coordinate2D(8.0, 10.5);
  Envelope mf_env = EnvelopeBuilder.CreateEnvelope(mf_ll, mf_ur);

  //Reference map, create MF and add to layout
  MapProjectItem mapPrjItem = Project.Current.GetItems<MapProjectItem>().FirstOrDefault(item => item.Name.Equals("Map"));
  Map mfMap = mapPrjItem.GetMap();
  MapFrame mfElm = LayoutElementFactory.Instance.CreateMapFrame(layout, mf_env, mfMap);
  mfElm.SetName("New Map Frame");

  //Zoom to bookmark
  Bookmark bookmark = mfElm.Map.GetBookmarks().FirstOrDefault(b => b.Name == "Great Lakes");
  mfElm.SetCamera(bookmark);
});
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 7

See Also

Reference

IElementFactory Interface
IElementFactory Members
Overload List