ArcGIS Pro 2.3 API Reference Guide
SetCamera(Layer,Boolean) Method
Example 

ArcGIS.Desktop.Layouts Namespace > MapFrame Class > SetCamera Method : SetCamera(Layer,Boolean) Method
Sets the map frame extent using the a layer's extent. This method must be called on the MCT. Use QueuedTask.Run.
Syntax
Public Overloads Sub SetCamera( _
   ByVal layer As Layer, _
   Optional ByVal useSelectedFeatures As Boolean _
) 
public void SetCamera( 
   Layer layer,
   bool useSelectedFeatures
)

Parameters

layer
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
//Zoom map frame to the extent of a single layer.

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

  //Reference map and layer
  Map m = mf.Map;
  FeatureLayer lyr = m.FindLayers("GreatLakes").First() as FeatureLayer;

  //Set the map frame extent to all features in the layer
  mf.SetCamera(lyr, false);
});
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 7

See Also

Reference

MapFrame Class
MapFrame Members
Overload List