<?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: Populate a XAML combo box with field names from a dataset? in ArcGIS API for Silverlight Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/populate-a-xaml-combo-box-with-field-names-from-a/m-p/748321#M19150</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you for the answer! I will definitely try this.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 13 Sep 2011 20:58:35 GMT</pubDate>
    <dc:creator>JonathanHouck</dc:creator>
    <dc:date>2011-09-13T20:58:35Z</dc:date>
    <item>
      <title>Populate a XAML combo box with field names from a dataset?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/populate-a-xaml-combo-box-with-field-names-from-a/m-p/748319#M19148</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello everyone,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is all using Silverlight 4 with the REST API and C# code behind.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm trying to populate a combobox with all the field names from a dataset so I can capture the user's selection and pass it into a query that they have constructed on their own. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I can't figure out how to get an array or list (or anything) with the field names that I can then iteratively add to the combobox.Items.&amp;nbsp; I've got some queries set up in my other project but they're querying against rows (features) and not just against the field names. I don't want to hard code any field names because I want the box to populate dynamically depending on which dataset they want to query.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Am I going about this wrong or just missing something obvious? Thanks for your help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jon&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Sep 2011 16:35:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/populate-a-xaml-combo-box-with-field-names-from-a/m-p/748319#M19148</guid>
      <dc:creator>JonathanHouck</dc:creator>
      <dc:date>2011-09-13T16:35:03Z</dc:date>
    </item>
    <item>
      <title>Re: Populate a XAML combo box with field names from a dataset?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/populate-a-xaml-combo-box-with-field-names-from-a/m-p/748320#M19149</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If you are using FeatureLayer, you can use the following code to get Field.Names:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;lt;ComboBox ItemsSource="{Binding ElementName=MyMap, Path=Layers[IncidentsLayer].LayerInfo.Fields}"&amp;gt;
 &amp;lt;ComboBox.ItemTemplate&amp;gt;
&amp;nbsp; &amp;lt;DataTemplate&amp;gt;
&amp;nbsp;&amp;nbsp; &amp;lt;TextBlock Text="{Binding Name}"/&amp;gt;
&amp;nbsp; &amp;lt;/DataTemplate&amp;gt;
 &amp;lt;/ComboBox.ItemTemplate&amp;gt;
&amp;lt;/ComboBox&amp;gt;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 07:48:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/populate-a-xaml-combo-box-with-field-names-from-a/m-p/748320#M19149</guid>
      <dc:creator>JenniferNery</dc:creator>
      <dc:date>2021-12-12T07:48:29Z</dc:date>
    </item>
    <item>
      <title>Re: Populate a XAML combo box with field names from a dataset?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/populate-a-xaml-combo-box-with-field-names-from-a/m-p/748321#M19150</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you for the answer! I will definitely try this.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Sep 2011 20:58:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/populate-a-xaml-combo-box-with-field-names-from-a/m-p/748321#M19150</guid>
      <dc:creator>JonathanHouck</dc:creator>
      <dc:date>2011-09-13T20:58:35Z</dc:date>
    </item>
    <item>
      <title>Re: Populate a XAML combo box with field names from a dataset?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/populate-a-xaml-combo-box-with-field-names-from-a/m-p/748322#M19151</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I've got one followup question:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is it possible to update that binding in the code behind?&amp;nbsp; I don't want to have to write a separate combobox for every single layer I want to query against; but when I try:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;QueryFormCombo1.ItemsSource = "{Binding ElementName=MyMap, Path=Layers[MyLayer].LayerInfo.Fields}";&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In the C# to change the binding it doesn't work; the combobox shows up empty.&amp;nbsp; Is there a way to do this? I'm worried I'm misunderstanding something about how feature layers work.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Sep 2011 19:07:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/populate-a-xaml-combo-box-with-field-names-from-a/m-p/748322#M19151</guid>
      <dc:creator>JonathanHouck</dc:creator>
      <dc:date>2011-09-14T19:07:17Z</dc:date>
    </item>
    <item>
      <title>Re: Populate a XAML combo box with field names from a dataset?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/populate-a-xaml-combo-box-with-field-names-from-a/m-p/748323#M19152</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You can't initialize a binding by code just by setting a string.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;But anyway in your case, I am not sure you need a binding when done by code.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Just set the ItemsSource:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; QueryFormCombo1.ItemsSource = (myMap.Layers["MyLayer"] as FeatureLayer).LayerInfo.Fields;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Sep 2011 07:13:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/populate-a-xaml-combo-box-with-field-names-from-a/m-p/748323#M19152</guid>
      <dc:creator>DominiqueBroux</dc:creator>
      <dc:date>2011-09-15T07:13:32Z</dc:date>
    </item>
    <item>
      <title>Re: Populate a XAML combo box with field names from a dataset?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/populate-a-xaml-combo-box-with-field-names-from-a/m-p/748324#M19153</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Okay, everything in this thread has worked perfectly so far, but now in the next phase of this project I'm hitting another snag.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I populate the combobox this way, whenever I try to get the selected item as a string, it doesn't give me the actual field name, it gives me the type of object.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So If I go:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;QueryFormCombo1.ItemsSource = (MyMap.Layers[LayerComboBoxItem] as FeatureLayer).LayerInfo.Fields;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And then I select and item, and go:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;queryPartOne = QueryFormCombo1.SelectedItem.ToString();&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It returns "ESRI.ArcGIS.Client.Field" and I can't figure out how to get the actual text, not just what it is.&amp;nbsp; I'm sorry if this is a dumb question, I'm kind of learning as I go here and I've been spinning my wheels on this one for awhile.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Oct 2011 14:17:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/populate-a-xaml-combo-box-with-field-names-from-a/m-p/748324#M19153</guid>
      <dc:creator>JonathanHouck</dc:creator>
      <dc:date>2011-10-05T14:17:29Z</dc:date>
    </item>
    <item>
      <title>Re: Populate a XAML combo box with field names from a dataset?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/populate-a-xaml-combo-box-with-field-names-from-a/m-p/748325#M19154</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm just guessing cause I'm new at this too!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;queryPartOne = (QueryFormCombo1.SelectedItem As Field).Name;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Oct 2011 15:02:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/populate-a-xaml-combo-box-with-field-names-from-a/m-p/748325#M19154</guid>
      <dc:creator>MichaelKohler</dc:creator>
      <dc:date>2011-10-05T15:02:24Z</dc:date>
    </item>
    <item>
      <title>Re: Populate a XAML combo box with field names from a dataset?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/populate-a-xaml-combo-box-with-field-names-from-a/m-p/748326#M19155</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Wow, thanks! Perfect, exactly what I was looking for.&amp;nbsp; Love these forums.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Oct 2011 15:07:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/populate-a-xaml-combo-box-with-field-names-from-a/m-p/748326#M19155</guid>
      <dc:creator>JonathanHouck</dc:creator>
      <dc:date>2011-10-05T15:07:20Z</dc:date>
    </item>
    <item>
      <title>Re: Populate a XAML combo box with field names from a dataset?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/populate-a-xaml-combo-box-with-field-names-from-a/m-p/748327#M19156</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;yes... without these fourms my project would be dead in the water! I've gotten so much help and am just trying to pay it back while trolling the forums to find an answer to my current headache!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Oct 2011 15:11:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/populate-a-xaml-combo-box-with-field-names-from-a/m-p/748327#M19156</guid>
      <dc:creator>MichaelKohler</dc:creator>
      <dc:date>2011-10-05T15:11:41Z</dc:date>
    </item>
    <item>
      <title>Re: Populate a XAML combo box with field names from a dataset?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/populate-a-xaml-combo-box-with-field-names-from-a/m-p/748328#M19157</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi All,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am usingthe following code to try to populate a combo box as explaned in this thread. The combobox populates but all the entries are "ESRI.ArcGIS.Client.Field". I can not figure out how to populate the box with the field values. Any ideas..&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;QueryComboBox.ItemsSource = (MapApplication.Current.SelectedLayer as FeatureLayer).LayerInfo.Fields;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Feb 2012 16:31:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/populate-a-xaml-combo-box-with-field-names-from-a/m-p/748328#M19157</guid>
      <dc:creator>BrianLeroux</dc:creator>
      <dc:date>2012-02-15T16:31:06Z</dc:date>
    </item>
    <item>
      <title>Re: Populate a XAML combo box with field names from a dataset?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/populate-a-xaml-combo-box-with-field-names-from-a/m-p/748329#M19158</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Hi All,&lt;BR /&gt;&lt;BR /&gt;I am usingthe following code to try to populate a combo box as explaned in this thread. The combobox populates but all the entries are "ESRI.ArcGIS.Client.Field". I can not figure out how to populate the box with the field values. Any ideas..&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;QueryComboBox.ItemsSource = (MapApplication.Current.SelectedLayer as FeatureLayer).LayerInfo.Fields;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What happens if you set the ComboBox's DisplayMemberPath to "Name"?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 18 Feb 2012 15:18:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/populate-a-xaml-combo-box-with-field-names-from-a/m-p/748329#M19158</guid>
      <dc:creator>LanceCrumbliss</dc:creator>
      <dc:date>2012-02-18T15:18:12Z</dc:date>
    </item>
    <item>
      <title>Re: Populate a XAML combo box with field names from a dataset?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/populate-a-xaml-combo-box-with-field-names-from-a/m-p/748330#M19159</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;What happens if you set the ComboBox's DisplayMemberPath to "Name"?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the suggestion. I will give it a try when I have a chance. I was able to populate my combo box with the following code.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;private void updateQueryCombo()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (Field field in (MapApplication.Current.SelectedLayer as FeatureLayer).LayerInfo.Fields)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; QueryComboBox.Items.Add(field.Name.ToString());
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 07:48:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/populate-a-xaml-combo-box-with-field-names-from-a/m-p/748330#M19159</guid>
      <dc:creator>BrianLeroux</dc:creator>
      <dc:date>2021-12-12T07:48:32Z</dc:date>
    </item>
  </channel>
</rss>

