<?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: Project Template   vs. layout Template in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/project-template/m-p/1281993#M9729</link>
    <description>The aptx file is usually loaded into the Pro as a projec, use the layout template for a map layout. You can use code to use the 'current active map' as the primary may shown in the newly created layout template. Recall templates can have 'tags' for text items, this means you can search for them an replace the text as well (e.g., in this example we have map layout template with Title1, subtitle1, Title2, subtitle2, etc. tags that get populated form a form) prior to executing the LoadLayoutTemplate sub.&lt;BR /&gt;internal static void LoadLayoutTemplate(string myMapTemplatePath, string lytTitle1, string lytTitle2, string lytSubTitle1, string lytSubTitle2, string lytDateInfo, string lytDataSource, Map lytMap, Envelope lytEnvelope)&lt;BR /&gt;{&lt;BR /&gt;// Load WSDOT Layout templates, added as a Tool at ArcGIS Pro 2.9.&lt;BR /&gt;try&lt;BR /&gt;{&lt;BR /&gt;IProjectItem myItem = ItemFactory.Instance.Create(@myMapTemplatePath, ItemFactory.ItemType.PathItem) as IProjectItem;&lt;BR /&gt;IProjectMultiItem myMultiItem = myItem as IProjectMultiItem;&lt;BR /&gt;LoadNewLayoutItem(myMultiItem, lytTitle1, lytTitle2, lytSubTitle1, lytSubTitle2, lytDateInfo, lytDataSource, lytMap, lytEnvelope);&lt;BR /&gt;}&lt;BR /&gt;catch (Exception eX)&lt;BR /&gt;{&lt;BR /&gt;ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Unable to Load requested Layout template ( internal static void LoadLayoutTemplate(string myMapTemplatePath, string lytTitle1, string lytTitle2, string lytSubTitle1, string lytSubTitle2, string lytDateInfo, string lytDataSource, Map lytMap, Envelope lytEnvelope)&lt;BR /&gt;{&lt;BR /&gt;// Load WSDOT Layout templates, added as a Tool at ArcGIS Pro 2.6.&lt;BR /&gt;try&lt;BR /&gt;{&lt;BR /&gt;IProjectItem myItem = ItemFactory.Instance.Create(@myMapTemplatePath, ItemFactory.ItemType.PathItem) as IProjectItem;&lt;BR /&gt;IProjectMultiItem myMultiItem = myItem as IProjectMultiItem;&lt;BR /&gt;LoadNewLayoutItem(myMultiItem, lytTitle1, lytTitle2, lytSubTitle1, lytSubTitle2, lytDateInfo, lytDataSource, lytMap, lytEnvelope);&lt;BR /&gt;}&lt;BR /&gt;catch (Exception eX)&lt;BR /&gt;{&lt;BR /&gt;ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Unable to Load requested Layout template (pagx). " + eX.ToString(),"Information",0);&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;public async static void LoadNewLayoutItem(IProjectMultiItem theItem, string lytTitle1, string lytTitle2, string lytSubTitle1, string lytSubTitle2, string lytDateInfo, string lytDataSource, Map lytMap, Envelope lytEnvelope)&lt;BR /&gt;{&lt;BR /&gt;//add the newly project item to the current project; must be public to avoid threading errors!&lt;BR /&gt;try&lt;BR /&gt;{&lt;BR /&gt;//add the layout to the project and wait for import to complete&lt;BR /&gt;await QueuedTask.Run(() =&amp;gt; Project.Current.ImportItem(theItem, true));&lt;BR /&gt;//wait 1 econdto ensure we are Ready&lt;BR /&gt;await Task.Delay(1000);&lt;BR /&gt;// Reference the new active layout in the project&lt;BR /&gt;LayoutView lytView = LayoutView.Active;&lt;BR /&gt;if (lytView != null)&lt;BR /&gt;{&lt;BR /&gt;await QueuedTask.Run(() =&amp;gt;&lt;BR /&gt;{&lt;BR /&gt;Layout myLayout = lytView.Layout;&lt;BR /&gt;// set the text elements based on values passed from frmLayouts&lt;BR /&gt;// help at &lt;A href="https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/index.html#topic11176.html" target="_blank"&gt;https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/index.html#topic11176.html&lt;/A&gt;&lt;BR /&gt;// &lt;A href="https://github.com/Esri/arcgis-pro-sdk/blob/master/Examples/Layouts/MethodSnippets.cs" target="_blank"&gt;https://github.com/Esri/arcgis-pro-sdk/blob/master/Examples/Layouts/MethodSnippets.cs&lt;/A&gt;&lt;BR /&gt;TextElement txtTitles = myLayout.FindElement("Title1") as TextElement;&lt;BR /&gt;if (txtTitles != null)&lt;BR /&gt;{&lt;BR /&gt;TextProperties txtProp = new TextProperties(lytTitle1, txtTitles.TextProperties.Font, txtTitles.TextProperties.FontSize, txtTitles.TextProperties.FontStyle);&lt;BR /&gt;txtTitles.SetTextProperties(txtProp);&lt;BR /&gt;}&lt;BR /&gt;txtTitles = myLayout.FindElement("Title2") as TextElement;&lt;BR /&gt;if (txtTitles != null)&lt;BR /&gt;{&lt;BR /&gt;TextProperties txtProp = new TextProperties(lytTitle2, txtTitles.TextProperties.Font, txtTitles.TextProperties.FontSize, txtTitles.TextProperties.FontStyle);&lt;BR /&gt;txtTitles.SetTextProperties(txtProp);&lt;BR /&gt;}&lt;BR /&gt;txtTitles = myLayout.FindElement("SubTitle1") as TextElement;&lt;BR /&gt;if (txtTitles != null)&lt;BR /&gt;{&lt;BR /&gt;TextProperties txtProp = new TextProperties(lytSubTitle1, txtTitles.TextProperties.Font, txtTitles.TextProperties.FontSize, txtTitles.TextProperties.FontStyle);&lt;BR /&gt;txtTitles.SetTextProperties(txtProp);&lt;BR /&gt;}&lt;BR /&gt;txtTitles = myLayout.FindElement("SubTitle2") as TextElement;&lt;BR /&gt;if (txtTitles != null)&lt;BR /&gt;{&lt;BR /&gt;TextProperties txtProp = new TextProperties(lytSubTitle2, txtTitles.TextProperties.Font, txtTitles.TextProperties.FontSize, txtTitles.TextProperties.FontStyle);&lt;BR /&gt;txtTitles.SetTextProperties(txtProp);&lt;BR /&gt;}&lt;BR /&gt;txtTitles = myLayout.FindElement("DateInfo") as TextElement;&lt;BR /&gt;if (txtTitles != null)&lt;BR /&gt;{&lt;BR /&gt;TextProperties txtProp = new TextProperties(lytDateInfo, txtTitles.TextProperties.Font, txtTitles.TextProperties.FontSize, txtTitles.TextProperties.FontStyle);&lt;BR /&gt;txtTitles.SetTextProperties(txtProp);&lt;BR /&gt;}&lt;BR /&gt;txtTitles = myLayout.FindElement("DataSource") as TextElement;&lt;BR /&gt;if (txtTitles != null)&lt;BR /&gt;{&lt;BR /&gt;TextProperties txtProp = new TextProperties(lytDataSource, txtTitles.TextProperties.Font, txtTitles.TextProperties.FontSize, txtTitles.TextProperties.FontStyle);&lt;BR /&gt;txtTitles.SetTextProperties(txtProp);&lt;BR /&gt;}&lt;BR /&gt;MapFrame frameMap = myLayout.FindElement("Layers Map Frame") as MapFrame;&lt;BR /&gt;if (frameMap != null)&lt;BR /&gt;{&lt;BR /&gt;//Update the MapFrame to use the Map that was active when the tool was run; set layout map element envelope based on the active map (added 1/28/2022)&lt;BR /&gt;if (lytMap != null)&lt;BR /&gt;{&lt;BR /&gt;frameMap.SetMap(lytMap);&lt;BR /&gt;frameMap.SetCamera(lytEnvelope);&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;});&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;catch (Exception eX)&lt;BR /&gt;{&lt;BR /&gt;//do nothing&lt;BR /&gt;ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("System Error: " + eX.ToString(), "Error",0);&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;). " + eX.ToString(),"Information",0);&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;public async static void LoadNewLayoutItem(IProjectMultiItem theItem, string lytTitle1, string lytTitle2, string lytSubTitle1, string lytSubTitle2, string lytDateInfo, string lytDataSource, Map lytMap, Envelope lytEnvelope)&lt;BR /&gt;{&lt;BR /&gt;//add the newly project item to the current project; must be public to avoid threading errors!&lt;BR /&gt;try&lt;BR /&gt;{&lt;BR /&gt;//add the layout to the project and wait for import to complete&lt;BR /&gt;await QueuedTask.Run(() =&amp;gt; Project.Current.ImportItem(theItem, true));&lt;BR /&gt;//wait 1 econdto ensure we are Ready&lt;BR /&gt;await Task.Delay(1000);&lt;BR /&gt;// Reference the new active layout in the project&lt;BR /&gt;LayoutView lytView = LayoutView.Active;&lt;BR /&gt;if (lytView != null)&lt;BR /&gt;{&lt;BR /&gt;await QueuedTask.Run(() =&amp;gt;&lt;BR /&gt;{&lt;BR /&gt;Layout myLayout = lytView.Layout;&lt;BR /&gt;// set the text elements based on values passed from frmLayouts&lt;BR /&gt;// help at &lt;A href="https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/index.html#topic11176.html" target="_blank"&gt;https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/index.html#topic11176.html&lt;/A&gt;&lt;BR /&gt;// &lt;A href="https://github.com/Esri/arcgis-pro-sdk/blob/master/Examples/Layouts/MethodSnippets.cs" target="_blank"&gt;https://github.com/Esri/arcgis-pro-sdk/blob/master/Examples/Layouts/MethodSnippets.cs&lt;/A&gt;&lt;BR /&gt;TextElement txtTitles = myLayout.FindElement("Title1") as TextElement;&lt;BR /&gt;if (txtTitles != null)&lt;BR /&gt;{&lt;BR /&gt;TextProperties txtProp = new TextProperties(lytTitle1, txtTitles.TextProperties.Font, txtTitles.TextProperties.FontSize, txtTitles.TextProperties.FontStyle);&lt;BR /&gt;txtTitles.SetTextProperties(txtProp);&lt;BR /&gt;}&lt;BR /&gt;txtTitles = myLayout.FindElement("Title2") as TextElement;&lt;BR /&gt;if (txtTitles != null)&lt;BR /&gt;{&lt;BR /&gt;TextProperties txtProp = new TextProperties(lytTitle2, txtTitles.TextProperties.Font, txtTitles.TextProperties.FontSize, txtTitles.TextProperties.FontStyle);&lt;BR /&gt;txtTitles.SetTextProperties(txtProp);&lt;BR /&gt;}&lt;BR /&gt;txtTitles = myLayout.FindElement("SubTitle1") as TextElement;&lt;BR /&gt;if (txtTitles != null)&lt;BR /&gt;{&lt;BR /&gt;TextProperties txtProp = new TextProperties(lytSubTitle1, txtTitles.TextProperties.Font, txtTitles.TextProperties.FontSize, txtTitles.TextProperties.FontStyle);&lt;BR /&gt;txtTitles.SetTextProperties(txtProp);&lt;BR /&gt;}&lt;BR /&gt;txtTitles = myLayout.FindElement("SubTitle2") as TextElement;&lt;BR /&gt;if (txtTitles != null)&lt;BR /&gt;{&lt;BR /&gt;TextProperties txtProp = new TextProperties(lytSubTitle2, txtTitles.TextProperties.Font, txtTitles.TextProperties.FontSize, txtTitles.TextProperties.FontStyle);&lt;BR /&gt;txtTitles.SetTextProperties(txtProp);&lt;BR /&gt;}&lt;BR /&gt;txtTitles = myLayout.FindElement("DateInfo") as TextElement;&lt;BR /&gt;if (txtTitles != null)&lt;BR /&gt;{&lt;BR /&gt;TextProperties txtProp = new TextProperties(lytDateInfo, txtTitles.TextProperties.Font, txtTitles.TextProperties.FontSize, txtTitles.TextProperties.FontStyle);&lt;BR /&gt;txtTitles.SetTextProperties(txtProp);&lt;BR /&gt;}&lt;BR /&gt;txtTitles = myLayout.FindElement("DataSource") as TextElement;&lt;BR /&gt;if (txtTitles != null)&lt;BR /&gt;{&lt;BR /&gt;TextProperties txtProp = new TextProperties(lytDataSource, txtTitles.TextProperties.Font, txtTitles.TextProperties.FontSize, txtTitles.TextProperties.FontStyle);&lt;BR /&gt;txtTitles.SetTextProperties(txtProp);&lt;BR /&gt;}&lt;BR /&gt;MapFrame frameMap = myLayout.FindElement("Layers Map Frame") as MapFrame;&lt;BR /&gt;if (frameMap != null)&lt;BR /&gt;{&lt;BR /&gt;//Update the MapFrame to use the Map that was active when the tool was run; set layout map element envelope based on the active map (added 1/28/2022)&lt;BR /&gt;if (lytMap != null)&lt;BR /&gt;{&lt;BR /&gt;frameMap.SetMap(lytMap);&lt;BR /&gt;frameMap.SetCamera(lytEnvelope);&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;});&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;catch (Exception eX)&lt;BR /&gt;{&lt;BR /&gt;//do nothing&lt;BR /&gt;ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("System Error: " + eX.ToString(), "Error",0);&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Mon, 24 Apr 2023 18:32:03 GMT</pubDate>
    <dc:creator>RichardDaniels</dc:creator>
    <dc:date>2023-04-24T18:32:03Z</dc:date>
    <item>
      <title>Project Template</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/project-template/m-p/1281742#M9728</link>
      <description>&lt;P&gt;I am developing a Pro AddIn using Pro version 3.1. How do I import a .aptx template file into an existing map?&lt;/P&gt;</description>
      <pubDate>Mon, 24 Apr 2023 08:11:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/project-template/m-p/1281742#M9728</guid>
      <dc:creator>LongNguyễnVăn</dc:creator>
      <dc:date>2023-04-24T08:11:26Z</dc:date>
    </item>
    <item>
      <title>Re: Project Template   vs. layout Template</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/project-template/m-p/1281993#M9729</link>
      <description>The aptx file is usually loaded into the Pro as a projec, use the layout template for a map layout. You can use code to use the 'current active map' as the primary may shown in the newly created layout template. Recall templates can have 'tags' for text items, this means you can search for them an replace the text as well (e.g., in this example we have map layout template with Title1, subtitle1, Title2, subtitle2, etc. tags that get populated form a form) prior to executing the LoadLayoutTemplate sub.&lt;BR /&gt;internal static void LoadLayoutTemplate(string myMapTemplatePath, string lytTitle1, string lytTitle2, string lytSubTitle1, string lytSubTitle2, string lytDateInfo, string lytDataSource, Map lytMap, Envelope lytEnvelope)&lt;BR /&gt;{&lt;BR /&gt;// Load WSDOT Layout templates, added as a Tool at ArcGIS Pro 2.9.&lt;BR /&gt;try&lt;BR /&gt;{&lt;BR /&gt;IProjectItem myItem = ItemFactory.Instance.Create(@myMapTemplatePath, ItemFactory.ItemType.PathItem) as IProjectItem;&lt;BR /&gt;IProjectMultiItem myMultiItem = myItem as IProjectMultiItem;&lt;BR /&gt;LoadNewLayoutItem(myMultiItem, lytTitle1, lytTitle2, lytSubTitle1, lytSubTitle2, lytDateInfo, lytDataSource, lytMap, lytEnvelope);&lt;BR /&gt;}&lt;BR /&gt;catch (Exception eX)&lt;BR /&gt;{&lt;BR /&gt;ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Unable to Load requested Layout template ( internal static void LoadLayoutTemplate(string myMapTemplatePath, string lytTitle1, string lytTitle2, string lytSubTitle1, string lytSubTitle2, string lytDateInfo, string lytDataSource, Map lytMap, Envelope lytEnvelope)&lt;BR /&gt;{&lt;BR /&gt;// Load WSDOT Layout templates, added as a Tool at ArcGIS Pro 2.6.&lt;BR /&gt;try&lt;BR /&gt;{&lt;BR /&gt;IProjectItem myItem = ItemFactory.Instance.Create(@myMapTemplatePath, ItemFactory.ItemType.PathItem) as IProjectItem;&lt;BR /&gt;IProjectMultiItem myMultiItem = myItem as IProjectMultiItem;&lt;BR /&gt;LoadNewLayoutItem(myMultiItem, lytTitle1, lytTitle2, lytSubTitle1, lytSubTitle2, lytDateInfo, lytDataSource, lytMap, lytEnvelope);&lt;BR /&gt;}&lt;BR /&gt;catch (Exception eX)&lt;BR /&gt;{&lt;BR /&gt;ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Unable to Load requested Layout template (pagx). " + eX.ToString(),"Information",0);&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;public async static void LoadNewLayoutItem(IProjectMultiItem theItem, string lytTitle1, string lytTitle2, string lytSubTitle1, string lytSubTitle2, string lytDateInfo, string lytDataSource, Map lytMap, Envelope lytEnvelope)&lt;BR /&gt;{&lt;BR /&gt;//add the newly project item to the current project; must be public to avoid threading errors!&lt;BR /&gt;try&lt;BR /&gt;{&lt;BR /&gt;//add the layout to the project and wait for import to complete&lt;BR /&gt;await QueuedTask.Run(() =&amp;gt; Project.Current.ImportItem(theItem, true));&lt;BR /&gt;//wait 1 econdto ensure we are Ready&lt;BR /&gt;await Task.Delay(1000);&lt;BR /&gt;// Reference the new active layout in the project&lt;BR /&gt;LayoutView lytView = LayoutView.Active;&lt;BR /&gt;if (lytView != null)&lt;BR /&gt;{&lt;BR /&gt;await QueuedTask.Run(() =&amp;gt;&lt;BR /&gt;{&lt;BR /&gt;Layout myLayout = lytView.Layout;&lt;BR /&gt;// set the text elements based on values passed from frmLayouts&lt;BR /&gt;// help at &lt;A href="https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/index.html#topic11176.html" target="_blank"&gt;https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/index.html#topic11176.html&lt;/A&gt;&lt;BR /&gt;// &lt;A href="https://github.com/Esri/arcgis-pro-sdk/blob/master/Examples/Layouts/MethodSnippets.cs" target="_blank"&gt;https://github.com/Esri/arcgis-pro-sdk/blob/master/Examples/Layouts/MethodSnippets.cs&lt;/A&gt;&lt;BR /&gt;TextElement txtTitles = myLayout.FindElement("Title1") as TextElement;&lt;BR /&gt;if (txtTitles != null)&lt;BR /&gt;{&lt;BR /&gt;TextProperties txtProp = new TextProperties(lytTitle1, txtTitles.TextProperties.Font, txtTitles.TextProperties.FontSize, txtTitles.TextProperties.FontStyle);&lt;BR /&gt;txtTitles.SetTextProperties(txtProp);&lt;BR /&gt;}&lt;BR /&gt;txtTitles = myLayout.FindElement("Title2") as TextElement;&lt;BR /&gt;if (txtTitles != null)&lt;BR /&gt;{&lt;BR /&gt;TextProperties txtProp = new TextProperties(lytTitle2, txtTitles.TextProperties.Font, txtTitles.TextProperties.FontSize, txtTitles.TextProperties.FontStyle);&lt;BR /&gt;txtTitles.SetTextProperties(txtProp);&lt;BR /&gt;}&lt;BR /&gt;txtTitles = myLayout.FindElement("SubTitle1") as TextElement;&lt;BR /&gt;if (txtTitles != null)&lt;BR /&gt;{&lt;BR /&gt;TextProperties txtProp = new TextProperties(lytSubTitle1, txtTitles.TextProperties.Font, txtTitles.TextProperties.FontSize, txtTitles.TextProperties.FontStyle);&lt;BR /&gt;txtTitles.SetTextProperties(txtProp);&lt;BR /&gt;}&lt;BR /&gt;txtTitles = myLayout.FindElement("SubTitle2") as TextElement;&lt;BR /&gt;if (txtTitles != null)&lt;BR /&gt;{&lt;BR /&gt;TextProperties txtProp = new TextProperties(lytSubTitle2, txtTitles.TextProperties.Font, txtTitles.TextProperties.FontSize, txtTitles.TextProperties.FontStyle);&lt;BR /&gt;txtTitles.SetTextProperties(txtProp);&lt;BR /&gt;}&lt;BR /&gt;txtTitles = myLayout.FindElement("DateInfo") as TextElement;&lt;BR /&gt;if (txtTitles != null)&lt;BR /&gt;{&lt;BR /&gt;TextProperties txtProp = new TextProperties(lytDateInfo, txtTitles.TextProperties.Font, txtTitles.TextProperties.FontSize, txtTitles.TextProperties.FontStyle);&lt;BR /&gt;txtTitles.SetTextProperties(txtProp);&lt;BR /&gt;}&lt;BR /&gt;txtTitles = myLayout.FindElement("DataSource") as TextElement;&lt;BR /&gt;if (txtTitles != null)&lt;BR /&gt;{&lt;BR /&gt;TextProperties txtProp = new TextProperties(lytDataSource, txtTitles.TextProperties.Font, txtTitles.TextProperties.FontSize, txtTitles.TextProperties.FontStyle);&lt;BR /&gt;txtTitles.SetTextProperties(txtProp);&lt;BR /&gt;}&lt;BR /&gt;MapFrame frameMap = myLayout.FindElement("Layers Map Frame") as MapFrame;&lt;BR /&gt;if (frameMap != null)&lt;BR /&gt;{&lt;BR /&gt;//Update the MapFrame to use the Map that was active when the tool was run; set layout map element envelope based on the active map (added 1/28/2022)&lt;BR /&gt;if (lytMap != null)&lt;BR /&gt;{&lt;BR /&gt;frameMap.SetMap(lytMap);&lt;BR /&gt;frameMap.SetCamera(lytEnvelope);&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;});&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;catch (Exception eX)&lt;BR /&gt;{&lt;BR /&gt;//do nothing&lt;BR /&gt;ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("System Error: " + eX.ToString(), "Error",0);&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;). " + eX.ToString(),"Information",0);&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;public async static void LoadNewLayoutItem(IProjectMultiItem theItem, string lytTitle1, string lytTitle2, string lytSubTitle1, string lytSubTitle2, string lytDateInfo, string lytDataSource, Map lytMap, Envelope lytEnvelope)&lt;BR /&gt;{&lt;BR /&gt;//add the newly project item to the current project; must be public to avoid threading errors!&lt;BR /&gt;try&lt;BR /&gt;{&lt;BR /&gt;//add the layout to the project and wait for import to complete&lt;BR /&gt;await QueuedTask.Run(() =&amp;gt; Project.Current.ImportItem(theItem, true));&lt;BR /&gt;//wait 1 econdto ensure we are Ready&lt;BR /&gt;await Task.Delay(1000);&lt;BR /&gt;// Reference the new active layout in the project&lt;BR /&gt;LayoutView lytView = LayoutView.Active;&lt;BR /&gt;if (lytView != null)&lt;BR /&gt;{&lt;BR /&gt;await QueuedTask.Run(() =&amp;gt;&lt;BR /&gt;{&lt;BR /&gt;Layout myLayout = lytView.Layout;&lt;BR /&gt;// set the text elements based on values passed from frmLayouts&lt;BR /&gt;// help at &lt;A href="https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/index.html#topic11176.html" target="_blank"&gt;https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/index.html#topic11176.html&lt;/A&gt;&lt;BR /&gt;// &lt;A href="https://github.com/Esri/arcgis-pro-sdk/blob/master/Examples/Layouts/MethodSnippets.cs" target="_blank"&gt;https://github.com/Esri/arcgis-pro-sdk/blob/master/Examples/Layouts/MethodSnippets.cs&lt;/A&gt;&lt;BR /&gt;TextElement txtTitles = myLayout.FindElement("Title1") as TextElement;&lt;BR /&gt;if (txtTitles != null)&lt;BR /&gt;{&lt;BR /&gt;TextProperties txtProp = new TextProperties(lytTitle1, txtTitles.TextProperties.Font, txtTitles.TextProperties.FontSize, txtTitles.TextProperties.FontStyle);&lt;BR /&gt;txtTitles.SetTextProperties(txtProp);&lt;BR /&gt;}&lt;BR /&gt;txtTitles = myLayout.FindElement("Title2") as TextElement;&lt;BR /&gt;if (txtTitles != null)&lt;BR /&gt;{&lt;BR /&gt;TextProperties txtProp = new TextProperties(lytTitle2, txtTitles.TextProperties.Font, txtTitles.TextProperties.FontSize, txtTitles.TextProperties.FontStyle);&lt;BR /&gt;txtTitles.SetTextProperties(txtProp);&lt;BR /&gt;}&lt;BR /&gt;txtTitles = myLayout.FindElement("SubTitle1") as TextElement;&lt;BR /&gt;if (txtTitles != null)&lt;BR /&gt;{&lt;BR /&gt;TextProperties txtProp = new TextProperties(lytSubTitle1, txtTitles.TextProperties.Font, txtTitles.TextProperties.FontSize, txtTitles.TextProperties.FontStyle);&lt;BR /&gt;txtTitles.SetTextProperties(txtProp);&lt;BR /&gt;}&lt;BR /&gt;txtTitles = myLayout.FindElement("SubTitle2") as TextElement;&lt;BR /&gt;if (txtTitles != null)&lt;BR /&gt;{&lt;BR /&gt;TextProperties txtProp = new TextProperties(lytSubTitle2, txtTitles.TextProperties.Font, txtTitles.TextProperties.FontSize, txtTitles.TextProperties.FontStyle);&lt;BR /&gt;txtTitles.SetTextProperties(txtProp);&lt;BR /&gt;}&lt;BR /&gt;txtTitles = myLayout.FindElement("DateInfo") as TextElement;&lt;BR /&gt;if (txtTitles != null)&lt;BR /&gt;{&lt;BR /&gt;TextProperties txtProp = new TextProperties(lytDateInfo, txtTitles.TextProperties.Font, txtTitles.TextProperties.FontSize, txtTitles.TextProperties.FontStyle);&lt;BR /&gt;txtTitles.SetTextProperties(txtProp);&lt;BR /&gt;}&lt;BR /&gt;txtTitles = myLayout.FindElement("DataSource") as TextElement;&lt;BR /&gt;if (txtTitles != null)&lt;BR /&gt;{&lt;BR /&gt;TextProperties txtProp = new TextProperties(lytDataSource, txtTitles.TextProperties.Font, txtTitles.TextProperties.FontSize, txtTitles.TextProperties.FontStyle);&lt;BR /&gt;txtTitles.SetTextProperties(txtProp);&lt;BR /&gt;}&lt;BR /&gt;MapFrame frameMap = myLayout.FindElement("Layers Map Frame") as MapFrame;&lt;BR /&gt;if (frameMap != null)&lt;BR /&gt;{&lt;BR /&gt;//Update the MapFrame to use the Map that was active when the tool was run; set layout map element envelope based on the active map (added 1/28/2022)&lt;BR /&gt;if (lytMap != null)&lt;BR /&gt;{&lt;BR /&gt;frameMap.SetMap(lytMap);&lt;BR /&gt;frameMap.SetCamera(lytEnvelope);&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;});&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;catch (Exception eX)&lt;BR /&gt;{&lt;BR /&gt;//do nothing&lt;BR /&gt;ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("System Error: " + eX.ToString(), "Error",0);&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 24 Apr 2023 18:32:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/project-template/m-p/1281993#M9729</guid>
      <dc:creator>RichardDaniels</dc:creator>
      <dc:date>2023-04-24T18:32:03Z</dc:date>
    </item>
  </channel>
</rss>

