var layout = LayoutView.Active.Layout; var mf = layout.GetElementsAsFlattenedList().OfType<MapFrame>() .First(mf => mf.Name == mapFrame); var autoCamera = mf.GetAutoCamera(); autoCamera.Source = AutoCameraSource.Fixed; autoCamera.AutoCameraType = AutoCameraType.Extent; var mf_extent = mf.GetViewExtent(); var extent = EnvelopeBuilderEx.CreateEnvelope( 400748.62, 800296.4, 1310669.05, 1424520.74, mf.Map.SpatialReference); autoCamera.Extent = extent; if (mf.ValidateAutoCamera(autoCamera) && !mf.IsMapSeriesMapFrame()) mf.SetAutoCamera(autoCamera);
Target Platforms: Windows 11, Windows 10, Windows 8.1