When I create and add a layer to a map, the map view's extent changes to the layer's extent if it is the first layer added to the Table of Contents (the first layer does not count the basemap). However, if I do the same thing but the created/added layer is not the first, the map view's extent stays the same, which is what I want.
The ArcGIS.Desktop.Mapping.LayerCreationParams class has the AutoZoomOnEmptyMap property, which details exactly what I want, but I cannot get it to work. What is going on?
Here is the applicable code:
// I tried FeatureLayerCreationParams too, which also didn't work, but I need the more general case.
LayerCreationParams lyrParams = new(uri) // uri is a path to a .lyrx file
{
AutoZoomOnEmptyMap = false
};
LayerFactory.Instance.CreateLayer<Layer>(lyrParams, MapView.Active.Map);
I have ArcGIS Pro 3.1.2 installed and am using the ArcGIS Pro 3.1 SDK.