ArcGIS Pro 2.8 API Reference Guide
SetCamera(IEnumerable<Layer>,Boolean) Method
Example 

ArcGIS.Desktop.Layouts Namespace > MapFrame Class > SetCamera Method : SetCamera(IEnumerable<Layer>,Boolean) Method
A list of layers.
Sets the map frame extent using the extent of multiple layers. This method must be called on the MCT. Use QueuedTask.Run.
Syntax
Public Overloads Sub SetCamera( _
   ByVal layers As IEnumerable(Of Layer), _
   Optional ByVal useSelectedFeatures As Boolean _
) 

Parameters

layers
A list of layers.
useSelectedFeatures
Exceptions
ExceptionDescription
This method or property must be called within the lambda passed to QueuedTask.Run.
Remarks
SetCamera will have no effect a map frame's extent being driven by a map series.
Example
//Change the extent of a map frame to the selected features multiple layers.

//Perform on the worker thread
await QueuedTask.Run(() =>
{
  //Reference MapFrame
  MapFrame mf = layout.FindElement("Map Frame") as MapFrame;

  //Reference map, layers and create layer list
  Map m = mf.Map;
  FeatureLayer fl_1 = m.FindLayers("GreatLakes").First() as FeatureLayer;
  FeatureLayer fl_2 = m.FindLayers("States_WithRegions").First() as FeatureLayer;
  var layers = new[] { fl_1, fl_2 };
  //IEnumerable<Layer> layers = m.Layers;  //This creates a list of ALL layers in map.

  //Set the map frame extent to the selected features in the list of layers
  mf.SetCamera(layers, true);
});
Requirements

Target Platforms: Windows 10, Windows 8.1

See Also

Reference

MapFrame Class
MapFrame Members
Overload List