<?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 Re: How to Set name for Map Frame while reusing the Arcgis pro tool. in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-set-name-for-map-frame-while-reusing-the/m-p/1111574#M7288</link>
    <description>&lt;P&gt;public ICommand SelectLinearBandCommand =&amp;gt;&lt;BR /&gt;new ArcGIS.Desktop.Framework.RelayCommand(async () =&amp;gt;&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;var SelectToolcmd = FrameworkApplication.GetPlugInWrapper("esri_layouts_newMapFrameRectangleTool") as ICommand;&lt;BR /&gt;SelectToolcmd.Execute(null);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;//Added the below event and it pretty much worked&lt;BR /&gt;&lt;STRONG&gt;ArcGIS.Desktop.Layouts.Events.ElementAddedEvent.Subscribe(LinearBandButton);&lt;/STRONG&gt;&lt;BR /&gt;TreeListDataController.DisableThreadingProblemsDetection = true;&lt;BR /&gt;&lt;BR /&gt;},&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;() =&amp;gt; (FrameworkApplication.GetPlugInWrapper("esri_layouts_newMapFrameRectangleTool") as ICommand).CanExecute(null)&lt;BR /&gt;);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Wed, 27 Oct 2021 11:37:15 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2021-10-27T11:37:15Z</dc:date>
    <item>
      <title>How to Set name for Map Frame while reusing the Arcgis pro tool.</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-set-name-for-map-frame-while-reusing-the/m-p/1111159#M7273</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I need to add functionality in the layout to allow the user to add multiple Map Frames as needed. I'm using the ArcGIS Pro tool functionality (Tool&amp;nbsp;&lt;SPAN&gt;ID: esri_layouts_reshapeMapFrameRectangleTool) for this.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Below is the code snippet I have used:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ShabinaBano_0-1635233115617.png" style="width: 796px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/26178i44CB95245F21AD0F/image-dimensions/796x340?v=v2" width="796" height="340" role="button" title="ShabinaBano_0-1635233115617.png" alt="ShabinaBano_0-1635233115617.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;//reusing the pro tool&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;public ICommand SelectLinearBandCommand =&amp;gt;&lt;/P&gt;&lt;P&gt;new ArcGIS.Desktop.Framework.RelayCommand(() =&amp;gt;&lt;BR /&gt;{&lt;BR /&gt;var SelectLinearBandcmd = FrameworkApplication.GetPlugInWrapper("esri_layouts_newMapFrameRectangleTool") as ICommand;&lt;/P&gt;&lt;P&gt;SelectLinearBandcmd.Execute(null);&lt;/P&gt;&lt;P&gt;LinearBandButton(layout, map, mfElm);&lt;BR /&gt;},&lt;BR /&gt;() =&amp;gt; (FrameworkApplication.GetPlugInWrapper("esri_layouts_newMapFrameRectangleTool") as ICommand).CanExecute(null)&lt;BR /&gt;);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;//made function "LinearBandButton" and called that into above command&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;private async void LinearBandButton(Layout layout, Map map, MapFrame mfElm)&lt;BR /&gt;{&lt;BR /&gt;await QueuedTask.Run(() =&amp;gt;&lt;BR /&gt;{&lt;BR /&gt;layout = LayoutFactory.Instance.CreateLayout(LayoutConstants.Width, LayoutConstants.Height, LayoutConstants.Units);&lt;BR /&gt;layout.SetName(LayoutName);&lt;/P&gt;&lt;P&gt;ArcGIS.Core.Geometry.Envelope env = EnvelopeBuilder.CreateEnvelope(LayoutConstants.xMin, LayoutConstants.yMin, LayoutConstants.xMax, LayoutConstants.yMax);&lt;BR /&gt;MapGlobal.Instance.envelope = env;&lt;/P&gt;&lt;P&gt;MapProjectItem mapPrjItem = Project.Current.GetItems&amp;lt;MapProjectItem&amp;gt;().FirstOrDefault(item =&amp;gt; item.Name.Equals(LayoutConstants.MapName));&lt;/P&gt;&lt;P&gt;map = mapPrjItem.GetMap();&lt;BR /&gt;map.SetSpatialReference(sptlRef);&lt;BR /&gt;mfElm = LayoutElementFactory.Instance.CreateMapFrame(layout, env, map);&lt;BR /&gt;//When I add the Map Frame to the Layout, I want it to be called "Linear Band."&lt;BR /&gt;mfElm.SetName("Linear Band");&lt;BR /&gt;});&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;-------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;Issue:&lt;/STRONG&gt; The issue is that I need to set name('Linear Band') after the Map Frame is added to the layout, but the setName functionality is currently running before that, so the name does not change from "Map Frame" to "Linear Band." When we add the Map Frame to the layout, the default name is "Map Frame," which I want to change to "Linear Band."&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could anyone please assist me in resolving this issue? It would be great if you could provide a code snippet on how to do so.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Oct 2021 07:34:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-set-name-for-map-frame-while-reusing-the/m-p/1111159#M7273</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-10-26T07:34:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to Set name for Map Frame while reusing the Arcgis pro tool.</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-set-name-for-map-frame-while-reusing-the/m-p/1111462#M7286</link>
      <description>&lt;P&gt;this is probably a timing issue - the name change being applied before the UI refresh (related to the new element being added) has completed. Separate the name change in to its own QueuedTask and u should get the result u r looking for.&lt;/P&gt;&lt;P&gt;Like so:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;private async void LinearBandButton(Layout layout, Map map, MapFrame mfElm)
{

var mfElm = await QueuedTask.Run(() =&amp;gt;
{
layout = LayoutFactory.Instance.CreateLayout(...);
   ...
return LayoutElementFactory.Instance.CreateMapFrame(layout, env, map);
});

//separate queuedtask
QueuedTask.Run(()=&amp;gt; {
//When I add the Map Frame to the Layout, I want it to be called "Linear Band."
mfElm.SetName("Linear Band");
});
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Oct 2021 21:51:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-set-name-for-map-frame-while-reusing-the/m-p/1111462#M7286</guid>
      <dc:creator>CharlesMacleod</dc:creator>
      <dc:date>2021-10-26T21:51:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to Set name for Map Frame while reusing the Arcgis pro tool.</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-set-name-for-map-frame-while-reusing-the/m-p/1111574#M7288</link>
      <description>&lt;P&gt;public ICommand SelectLinearBandCommand =&amp;gt;&lt;BR /&gt;new ArcGIS.Desktop.Framework.RelayCommand(async () =&amp;gt;&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;var SelectToolcmd = FrameworkApplication.GetPlugInWrapper("esri_layouts_newMapFrameRectangleTool") as ICommand;&lt;BR /&gt;SelectToolcmd.Execute(null);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;//Added the below event and it pretty much worked&lt;BR /&gt;&lt;STRONG&gt;ArcGIS.Desktop.Layouts.Events.ElementAddedEvent.Subscribe(LinearBandButton);&lt;/STRONG&gt;&lt;BR /&gt;TreeListDataController.DisableThreadingProblemsDetection = true;&lt;BR /&gt;&lt;BR /&gt;},&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;() =&amp;gt; (FrameworkApplication.GetPlugInWrapper("esri_layouts_newMapFrameRectangleTool") as ICommand).CanExecute(null)&lt;BR /&gt;);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 27 Oct 2021 11:37:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-set-name-for-map-frame-while-reusing-the/m-p/1111574#M7288</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-10-27T11:37:15Z</dc:date>
    </item>
  </channel>
</rss>

