ArcGIS Pro 2.8 API Reference Guide
SetMapFrame Method
Example 

ArcGIS.Desktop.Layouts Namespace > MapSurround Class : SetMapFrame Method
MapFrame
Sets a MapFrame to the MapSurround. This method must be called on the MCT. Use QueuedTask.Run.
Syntax
public void SetMapFrame( 
   MapFrame mapFrame
)
Public Sub SetMapFrame( _
   ByVal mapFrame As MapFrame _
) 

Parameters

mapFrame
MapFrame
Exceptions
ExceptionDescription
This method or property must be called within the lambda passed to QueuedTask.Run.
Example
await QueuedTask.Run(() =>
{
  LayoutProjectItem layoutItem = Project.Current.GetItems<LayoutProjectItem>().FirstOrDefault(item => item.Name.Equals("Layout Name"));
  Layout lyt = layoutItem.GetLayout();
  MapFrame mf = lyt.FindElement("Map1 Map Frame") as MapFrame;
  MapSurround ms = lyt.FindElement("Scale Bar") as MapSurround;

  ms.SetMapFrame(mf);
});
Requirements

Target Platforms: Windows 10, Windows 8.1

See Also

Reference

MapSurround Class
MapSurround Members