<?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 ArcGIS Pro SDK - Update Map Frame's Map in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/arcgis-pro-sdk-update-map-frame-s-map/m-p/1053545#M40471</link>
    <description>&lt;P&gt;What I am trying to do is import a .pagx map template and use my active map (Layers) for the MapFrame in my template.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am able to import my .pagx map template. When it is imported, a new Map is created (Layers1) which from the map template layout. I have tried setting the MapFrame's .Map property but this is readonly.&lt;/P&gt;&lt;P&gt;It might not be the correct way to do this, but I was hoping I could set this property to my active map.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;var mv = MapView.Active;
var currentCamera = mv?.Camera;
QueuedTask.Run(() =&amp;gt;
{
    IProjectMultiItem pagx = ItemFactory.Instance.Create(TemplatePath) as IProjectMultiItem;
    Project.Current.ImportItem(pagx);
    LayoutProjectItem layoutItem = Project.Current.GetItems&amp;lt;LayoutProjectItem&amp;gt;().Last();
    // Get the layout from the layout template item
    Layout layout = layoutItem.GetLayout();
    if (mapFrame != null)
    {
        // Get map frame
        var mapFrameMap = mapFrame.Map;
        // Setting the mapFrameMap var does not make a change
        //mapFrameMap = mv.Map;
        mapFrame.Map = mv.Map;
        if (currentCamera != null)
            mapFrame.SetCamera(currentCamera);
    }
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 01 May 2021 18:44:16 GMT</pubDate>
    <dc:creator>julian_svcs</dc:creator>
    <dc:date>2021-05-01T18:44:16Z</dc:date>
    <item>
      <title>ArcGIS Pro SDK - Update Map Frame's Map</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcgis-pro-sdk-update-map-frame-s-map/m-p/1053545#M40471</link>
      <description>&lt;P&gt;What I am trying to do is import a .pagx map template and use my active map (Layers) for the MapFrame in my template.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am able to import my .pagx map template. When it is imported, a new Map is created (Layers1) which from the map template layout. I have tried setting the MapFrame's .Map property but this is readonly.&lt;/P&gt;&lt;P&gt;It might not be the correct way to do this, but I was hoping I could set this property to my active map.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;var mv = MapView.Active;
var currentCamera = mv?.Camera;
QueuedTask.Run(() =&amp;gt;
{
    IProjectMultiItem pagx = ItemFactory.Instance.Create(TemplatePath) as IProjectMultiItem;
    Project.Current.ImportItem(pagx);
    LayoutProjectItem layoutItem = Project.Current.GetItems&amp;lt;LayoutProjectItem&amp;gt;().Last();
    // Get the layout from the layout template item
    Layout layout = layoutItem.GetLayout();
    if (mapFrame != null)
    {
        // Get map frame
        var mapFrameMap = mapFrame.Map;
        // Setting the mapFrameMap var does not make a change
        //mapFrameMap = mv.Map;
        mapFrame.Map = mv.Map;
        if (currentCamera != null)
            mapFrame.SetCamera(currentCamera);
    }
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 01 May 2021 18:44:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcgis-pro-sdk-update-map-frame-s-map/m-p/1053545#M40471</guid>
      <dc:creator>julian_svcs</dc:creator>
      <dc:date>2021-05-01T18:44:16Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Pro SDK - Update Map Frame's Map</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcgis-pro-sdk-update-map-frame-s-map/m-p/1053586#M40473</link>
      <description>&lt;P&gt;I found that the &lt;FONT color="#FF9900"&gt;&lt;STRONG&gt;mapFrame.Map&lt;/STRONG&gt;&lt;/FONT&gt; is read only. I used the &lt;FONT color="#339966"&gt;&lt;STRONG&gt;mapFrame.SetMap(mv.Map)&lt;/STRONG&gt;&lt;/FONT&gt;. This will set the map frame to my original map.&lt;/P&gt;&lt;P&gt;This does however still add a new Map (Layers1) to the project. Is this expected? If yes, would I just need to delete it once the Layout has been created?&lt;/P&gt;</description>
      <pubDate>Sun, 02 May 2021 07:02:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcgis-pro-sdk-update-map-frame-s-map/m-p/1053586#M40473</guid>
      <dc:creator>julian_svcs</dc:creator>
      <dc:date>2021-05-02T07:02:17Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Pro SDK - Update Map Frame's Map</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcgis-pro-sdk-update-map-frame-s-map/m-p/1054819#M40618</link>
      <description>&lt;P&gt;For now, I am deleting the map item that is created (Layers1) from the project:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;MapFrame mapFrame = layout.FindElement("Map Frame") as MapFrame;
MapProjectItem OriginalLayoutMap = Project.Current.GetItems&amp;lt;MapProjectItem&amp;gt;().FirstOrDefault(item =&amp;gt; item.Name.Equals(mapFrame.Map.Name));
// Set map frame to original active map
mapFrame.SetMap(OriginalActiveMap.Map);
// Delete new OriginalLayoutMap created
Project.Current.RemoveItem(OriginalLayoutMap);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 May 2021 18:33:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcgis-pro-sdk-update-map-frame-s-map/m-p/1054819#M40618</guid>
      <dc:creator>julian_svcs</dc:creator>
      <dc:date>2021-05-05T18:33:24Z</dc:date>
    </item>
  </channel>
</rss>

