<?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: populating ProWindow combo box control with values at load or show in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/populating-prowindow-combo-box-control-with-values/m-p/1495993#M11723</link>
    <description>&lt;P&gt;In answer to my own question, my Googling finally brought forth a solution that worked for referencing the control. Here's how I have implemented it:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;        private void cboLayerList_Loaded(object sender, RoutedEventArgs e)
        {
            var layerlist = MapView.Active.Map.GetLayersAsFlattenedList().OfType&amp;lt;BasicRasterLayer&amp;gt;();
            var theCombobox = (System.Windows.Controls.ComboBox)this.FindName("cboLayerList");

            theCombobox.Items.Clear();

            foreach (var layer in layerlist) {
                theCombobox.Items.Add(layer.Name);
            }

        }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 21 Jun 2024 14:57:30 GMT</pubDate>
    <dc:creator>SteveCole</dc:creator>
    <dc:date>2024-06-21T14:57:30Z</dc:date>
    <item>
      <title>populating ProWindow combo box control with values at load or show</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/populating-prowindow-combo-box-control-with-values/m-p/1495530#M11711</link>
      <description>&lt;P&gt;Now diving into the Pro SDK after so much time in the VBA &amp;amp; even VB.NET add-in sphere and I'm struggling with how to accomplish a specific task. I'm sure these are growing pains with C# but the Pro SDK isn't really doing me any favors about this either.&lt;/P&gt;&lt;P&gt;I have a ProWindow which prompts the user to provide input parameters for tweaking the color ramp of a raster in the TOC. What I would like to do is populate a combo box with a list of the rasters in the TOC. I have the code to retrieve a list of rasters in the map:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;var layerlist = MapView.Active.Map.GetLayersAsFlattenedList().OfType&amp;lt;BasicRasterLayer&amp;gt;();&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but what I cannot figure out is how to insert this list of layers into the combo box. I've figured out how to find the event associated with the control but the process of&amp;nbsp;&lt;EM&gt;how&lt;/EM&gt; to populate it's data source is lost on me:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;        private void cboLayerList_Loaded(object sender, RoutedEventArgs e)
        {
            var layerlist = MapView.Active.Map.GetLayersAsFlattenedList().OfType&amp;lt;BasicRasterLayer&amp;gt;();
            
        }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My control's name (cboLayerList) doesn't appear in the Intellisense suggestions so I'm at a loss as to how to hook into the control to populate the list of layers. There is a &lt;A href="https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Map-Exploration/ComboBoxShowingLayers" target="_blank" rel="noopener"&gt;community sample about a combo box showing layers&lt;/A&gt; but I can't make the connection between that sample and how I'm trying to populate a combo box in my ProWindow.&lt;/P&gt;&lt;P&gt;What am I missing (besides an understanding of C#)?&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jun 2024 17:40:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/populating-prowindow-combo-box-control-with-values/m-p/1495530#M11711</guid>
      <dc:creator>SteveCole</dc:creator>
      <dc:date>2024-06-20T17:40:27Z</dc:date>
    </item>
    <item>
      <title>Re: populating ProWindow combo box control with values at load or show</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/populating-prowindow-combo-box-control-with-values/m-p/1495993#M11723</link>
      <description>&lt;P&gt;In answer to my own question, my Googling finally brought forth a solution that worked for referencing the control. Here's how I have implemented it:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;        private void cboLayerList_Loaded(object sender, RoutedEventArgs e)
        {
            var layerlist = MapView.Active.Map.GetLayersAsFlattenedList().OfType&amp;lt;BasicRasterLayer&amp;gt;();
            var theCombobox = (System.Windows.Controls.ComboBox)this.FindName("cboLayerList");

            theCombobox.Items.Clear();

            foreach (var layer in layerlist) {
                theCombobox.Items.Add(layer.Name);
            }

        }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2024 14:57:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/populating-prowindow-combo-box-control-with-values/m-p/1495993#M11723</guid>
      <dc:creator>SteveCole</dc:creator>
      <dc:date>2024-06-21T14:57:30Z</dc:date>
    </item>
  </channel>
</rss>

