<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic MapView.Active.Map not showing the actually active map? in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/mapview-active-map-not-showing-the-actually-active/m-p/1591961#M12703</link>
    <description>&lt;P&gt;I have a form that lets people select a feature, and the map zooms to that feature. The basic code behind that is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;// Make the selection the active PAN
PropertyInspectorDockPaneViewModel.Instance.PAN = selection;

// Knowing the PAN, clear all other highlights, highlight selected PAN and zoom in.
var layer = MapView.Active.Map.GetLayersAsFlattenedList().OfType&amp;lt;FeatureLayer&amp;gt;().Where(fl =&amp;gt; fl.Name.Contains("Parcels")).FirstOrDefault();
QueuedTask.Run(layer.ClearSelection);
QueryFilter qf = new QueryFilter
{
    WhereClause = $@"PAN = {selection}"
};
QueuedTask.Run(() =&amp;gt;
{
    var mySelect = layer.Select(qf);
    MapView.Active.ZoomToSelected();
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This works as expected, with the map in ArcGIS Pro zooming to and selecting that feature. However, once that is displayed, I have an option that creates a new view, and it should take that map and place it in the view. But it seems to be looking at some other section of the map. The code for creating that portion of the view is below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;// The map to add to this layout is the current map.
Map currMap = MapView.Active.Map;

// Build a map frame geometry and envelope
Coordinate2D ur = new Coordinate2D(8.0, 9.75);
Coordinate2D ll = new Coordinate2D(.5, 6);
Envelope mapEnv = EnvelopeBuilderEx.CreateEnvelope(ur, ll);

// Create the map frame and add it to the layout.
MapFrame newMapFrame = ElementFactory.Instance.CreateMapFrameElement(newLayout, mapEnv, currMap);
newMapFrame.SetName("Selected Area");
Camera camera = newMapFrame.Camera;
camera.Scale = 850;
newMapFrame.SetCamera(camera);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not sure why that would happen. Below are images of the results:&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="aftersearcg.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/126974i7D200255BDF38065/image-size/medium?v=v2&amp;amp;px=400" role="button" title="aftersearcg.png" alt="aftersearcg.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is after the search, with the selected feature highlighted.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="afternewview.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/126975i693EF9145BAD5FB2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="afternewview.png" alt="afternewview.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is after creating the new view, showing a different area of the map, with no feature highlighted.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I suspect I've made some basic error, but I'm not sure what it is. Any help would be greatly appreciated.&lt;/P&gt;&lt;P&gt;Edit to add: If I click the Zoom To Map View button, as shown below, it knows what the view should be...&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="itknows.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/126986i30A7414390D63999/image-size/medium?v=v2&amp;amp;px=400" role="button" title="itknows.png" alt="itknows.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 04 Mar 2025 20:29:21 GMT</pubDate>
    <dc:creator>RogerAsbury</dc:creator>
    <dc:date>2025-03-04T20:29:21Z</dc:date>
    <item>
      <title>MapView.Active.Map not showing the actually active map?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/mapview-active-map-not-showing-the-actually-active/m-p/1591961#M12703</link>
      <description>&lt;P&gt;I have a form that lets people select a feature, and the map zooms to that feature. The basic code behind that is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;// Make the selection the active PAN
PropertyInspectorDockPaneViewModel.Instance.PAN = selection;

// Knowing the PAN, clear all other highlights, highlight selected PAN and zoom in.
var layer = MapView.Active.Map.GetLayersAsFlattenedList().OfType&amp;lt;FeatureLayer&amp;gt;().Where(fl =&amp;gt; fl.Name.Contains("Parcels")).FirstOrDefault();
QueuedTask.Run(layer.ClearSelection);
QueryFilter qf = new QueryFilter
{
    WhereClause = $@"PAN = {selection}"
};
QueuedTask.Run(() =&amp;gt;
{
    var mySelect = layer.Select(qf);
    MapView.Active.ZoomToSelected();
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This works as expected, with the map in ArcGIS Pro zooming to and selecting that feature. However, once that is displayed, I have an option that creates a new view, and it should take that map and place it in the view. But it seems to be looking at some other section of the map. The code for creating that portion of the view is below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;// The map to add to this layout is the current map.
Map currMap = MapView.Active.Map;

// Build a map frame geometry and envelope
Coordinate2D ur = new Coordinate2D(8.0, 9.75);
Coordinate2D ll = new Coordinate2D(.5, 6);
Envelope mapEnv = EnvelopeBuilderEx.CreateEnvelope(ur, ll);

// Create the map frame and add it to the layout.
MapFrame newMapFrame = ElementFactory.Instance.CreateMapFrameElement(newLayout, mapEnv, currMap);
newMapFrame.SetName("Selected Area");
Camera camera = newMapFrame.Camera;
camera.Scale = 850;
newMapFrame.SetCamera(camera);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not sure why that would happen. Below are images of the results:&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="aftersearcg.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/126974i7D200255BDF38065/image-size/medium?v=v2&amp;amp;px=400" role="button" title="aftersearcg.png" alt="aftersearcg.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is after the search, with the selected feature highlighted.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="afternewview.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/126975i693EF9145BAD5FB2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="afternewview.png" alt="afternewview.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is after creating the new view, showing a different area of the map, with no feature highlighted.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I suspect I've made some basic error, but I'm not sure what it is. Any help would be greatly appreciated.&lt;/P&gt;&lt;P&gt;Edit to add: If I click the Zoom To Map View button, as shown below, it knows what the view should be...&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="itknows.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/126986i30A7414390D63999/image-size/medium?v=v2&amp;amp;px=400" role="button" title="itknows.png" alt="itknows.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Mar 2025 20:29:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/mapview-active-map-not-showing-the-actually-active/m-p/1591961#M12703</guid>
      <dc:creator>RogerAsbury</dc:creator>
      <dc:date>2025-03-04T20:29:21Z</dc:date>
    </item>
    <item>
      <title>Re: MapView.Active.Map not showing the actually active map?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/mapview-active-map-not-showing-the-actually-active/m-p/1592435#M12710</link>
      <description>&lt;P&gt;Try to link the MapFrame's camera to the active map view's camera -&amp;nbsp; Something like this:&lt;/P&gt;&lt;P&gt;Camera camera = MapView.Active.Camera;&lt;BR /&gt;newMapFrame.SetCamera(camera);&lt;/P&gt;</description>
      <pubDate>Wed, 05 Mar 2025 19:52:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/mapview-active-map-not-showing-the-actually-active/m-p/1592435#M12710</guid>
      <dc:creator>UmaHarano</dc:creator>
      <dc:date>2025-03-05T19:52:42Z</dc:date>
    </item>
    <item>
      <title>Re: MapView.Active.Map not showing the actually active map?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/mapview-active-map-not-showing-the-actually-active/m-p/1592451#M12711</link>
      <description>&lt;P&gt;Thanks much, that seems to have done the trick. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Mar 2025 20:15:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/mapview-active-map-not-showing-the-actually-active/m-p/1592451#M12711</guid>
      <dc:creator>RogerAsbury</dc:creator>
      <dc:date>2025-03-05T20:15:32Z</dc:date>
    </item>
  </channel>
</rss>

