<?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 C# Code for ArcGIS Pro Add-in to retrieve text string from selected record of a layer in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/c-code-for-arcgis-pro-add-in-to-retrieve-text/m-p/1114694#M7324</link>
    <description>&lt;P&gt;Greetings,&lt;/P&gt;&lt;P&gt;Learning C# and I am looking for some code that will allow me to create a tool for the Map View, that when positioned over an individual polygon and selected&amp;nbsp;by the tool, would return the &lt;STRONG&gt;&lt;FONT color="#FF00FF"&gt;text string&amp;nbsp;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT color="#FF00FF"&gt;&lt;FONT color="#993300"&gt;&lt;FONT color="#000000"&gt;(e.g.&lt;/FONT&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#FF00FF"&gt;CntyGeo.lyrx)&lt;/FONT&gt;&lt;/STRONG&gt; from the attribute field (say "Link") of the selected feature layer in the Contents Pane.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would use this returned individual &lt;STRONG&gt;&lt;FONT color="#FF00FF"&gt;text string&lt;/FONT&gt;&lt;/STRONG&gt; to reference to another C# code that adds a .lyrx file to the Map View (see C# code below).&amp;nbsp; The &lt;STRONG&gt;&lt;FONT color="#FF00FF"&gt;text string&lt;/FONT&gt;&lt;/STRONG&gt; would be used to add an .lyrx&amp;nbsp; from the C:\ drive&amp;nbsp; (e.g. &lt;STRONG&gt;&lt;FONT color="#FF00FF"&gt;CntyGeo&lt;/FONT&gt;&lt;/STRONG&gt;.lyrx) to the Map View which currently works:&lt;/P&gt;&lt;P&gt;protected override void OnClick()&lt;BR /&gt;{&lt;BR /&gt;try { QueuedTask.Run(() =&amp;gt; { Uri myUri = new Uri(@"C:\Temp\&lt;STRONG&gt;&lt;FONT color="#FF00FF"&gt;CntyGeo&lt;/FONT&gt;&lt;/STRONG&gt;.lyrx"); Layer newlayer = LayerFactory.Instance.CreateFeatureLayer(myUri, MapView.Active.Map, LayerPosition.AddToTop); }); }&lt;BR /&gt;catch (Exception ex)&lt;BR /&gt;{&lt;BR /&gt;MessageBox.Show($@"Error: {ex.ToString()}");&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;I'm using ArcGIS Pro 2.8 and MS Visual Studio 2019.&amp;nbsp; Thanks for any help.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;John&lt;/P&gt;</description>
    <pubDate>Sat, 06 Nov 2021 00:03:31 GMT</pubDate>
    <dc:creator>JohnHanson1</dc:creator>
    <dc:date>2021-11-06T00:03:31Z</dc:date>
    <item>
      <title>C# Code for ArcGIS Pro Add-in to retrieve text string from selected record of a layer</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/c-code-for-arcgis-pro-add-in-to-retrieve-text/m-p/1114694#M7324</link>
      <description>&lt;P&gt;Greetings,&lt;/P&gt;&lt;P&gt;Learning C# and I am looking for some code that will allow me to create a tool for the Map View, that when positioned over an individual polygon and selected&amp;nbsp;by the tool, would return the &lt;STRONG&gt;&lt;FONT color="#FF00FF"&gt;text string&amp;nbsp;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT color="#FF00FF"&gt;&lt;FONT color="#993300"&gt;&lt;FONT color="#000000"&gt;(e.g.&lt;/FONT&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#FF00FF"&gt;CntyGeo.lyrx)&lt;/FONT&gt;&lt;/STRONG&gt; from the attribute field (say "Link") of the selected feature layer in the Contents Pane.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would use this returned individual &lt;STRONG&gt;&lt;FONT color="#FF00FF"&gt;text string&lt;/FONT&gt;&lt;/STRONG&gt; to reference to another C# code that adds a .lyrx file to the Map View (see C# code below).&amp;nbsp; The &lt;STRONG&gt;&lt;FONT color="#FF00FF"&gt;text string&lt;/FONT&gt;&lt;/STRONG&gt; would be used to add an .lyrx&amp;nbsp; from the C:\ drive&amp;nbsp; (e.g. &lt;STRONG&gt;&lt;FONT color="#FF00FF"&gt;CntyGeo&lt;/FONT&gt;&lt;/STRONG&gt;.lyrx) to the Map View which currently works:&lt;/P&gt;&lt;P&gt;protected override void OnClick()&lt;BR /&gt;{&lt;BR /&gt;try { QueuedTask.Run(() =&amp;gt; { Uri myUri = new Uri(@"C:\Temp\&lt;STRONG&gt;&lt;FONT color="#FF00FF"&gt;CntyGeo&lt;/FONT&gt;&lt;/STRONG&gt;.lyrx"); Layer newlayer = LayerFactory.Instance.CreateFeatureLayer(myUri, MapView.Active.Map, LayerPosition.AddToTop); }); }&lt;BR /&gt;catch (Exception ex)&lt;BR /&gt;{&lt;BR /&gt;MessageBox.Show($@"Error: {ex.ToString()}");&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;I'm using ArcGIS Pro 2.8 and MS Visual Studio 2019.&amp;nbsp; Thanks for any help.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;John&lt;/P&gt;</description>
      <pubDate>Sat, 06 Nov 2021 00:03:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/c-code-for-arcgis-pro-add-in-to-retrieve-text/m-p/1114694#M7324</guid>
      <dc:creator>JohnHanson1</dc:creator>
      <dc:date>2021-11-06T00:03:31Z</dc:date>
    </item>
  </channel>
</rss>

