<?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 Using a Combobox to change map and featurelayer URLs in ArcGIS API for Silverlight Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/using-a-combobox-to-change-map-and-featurelayer/m-p/693208#M17800</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am attampting to reference multiple maps to a single application. They all woulc consist of a mapserver and a single FeatureLayer which i would like to edit.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So far I have The following XAML&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
&amp;lt;ComboBox x:Name="combo_select" Height="33" Margin="57,405,48,0" VerticalAlignment="Top" SelectionChanged="SelectionChanged"&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;TextBlock Text="Standard Map" Tag="&amp;lt;url&amp;gt;/FeatureServer/0"/&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;TextBlock Text="Map Variant 2" Tag="&amp;lt;url&amp;gt;/FeatureServer/0"/&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/ComboBox&amp;gt;


esri:Map x:Name="Map" Background="White" Grid.Column="1" Margin="8" Grid.Row="1"&amp;gt;
&amp;nbsp;&amp;nbsp; &amp;lt;esri:ArcGISDynamicMapServiceLayer ID="Layers" Url="&amp;lt;url&amp;gt;/MapServer"/&amp;gt;
&amp;nbsp;&amp;nbsp; &amp;lt;esri:FeatureLayer ID="CB" Url="&amp;lt;url&amp;gt;FeatureServer/0"
&amp;nbsp;&amp;nbsp;&amp;nbsp; MouseLeftButtonUp="FeatureLayer_MouseLeftButtonUp" DisableClientCaching="True" AutoSave="False"
&amp;nbsp;&amp;nbsp;&amp;nbsp; Mode="OnDemand" OutFields="*"/&amp;gt;
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And for my C# code behind I have&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;private void SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
&amp;nbsp; {
&amp;nbsp; FeatureLayer arcgisLayer = Map.Layers["CB"] as FeatureLayer;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcgisLayer.Url = ((ComboBox)sender).Tag as string;&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I based my code on the radio button model from the sample. MY problems are 2 fold. The first is I have set it up to just change the featureLayers currently, however the layers do not change. Also my map is based on slightly differnet base maps and moving foreward i do not see the ability to change both the map url and the FeatureLayer URL.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 08 Nov 2010 19:32:39 GMT</pubDate>
    <dc:creator>WilliamDonahue</dc:creator>
    <dc:date>2010-11-08T19:32:39Z</dc:date>
    <item>
      <title>Using a Combobox to change map and featurelayer URLs</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/using-a-combobox-to-change-map-and-featurelayer/m-p/693208#M17800</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am attampting to reference multiple maps to a single application. They all woulc consist of a mapserver and a single FeatureLayer which i would like to edit.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So far I have The following XAML&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
&amp;lt;ComboBox x:Name="combo_select" Height="33" Margin="57,405,48,0" VerticalAlignment="Top" SelectionChanged="SelectionChanged"&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;TextBlock Text="Standard Map" Tag="&amp;lt;url&amp;gt;/FeatureServer/0"/&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;TextBlock Text="Map Variant 2" Tag="&amp;lt;url&amp;gt;/FeatureServer/0"/&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/ComboBox&amp;gt;


esri:Map x:Name="Map" Background="White" Grid.Column="1" Margin="8" Grid.Row="1"&amp;gt;
&amp;nbsp;&amp;nbsp; &amp;lt;esri:ArcGISDynamicMapServiceLayer ID="Layers" Url="&amp;lt;url&amp;gt;/MapServer"/&amp;gt;
&amp;nbsp;&amp;nbsp; &amp;lt;esri:FeatureLayer ID="CB" Url="&amp;lt;url&amp;gt;FeatureServer/0"
&amp;nbsp;&amp;nbsp;&amp;nbsp; MouseLeftButtonUp="FeatureLayer_MouseLeftButtonUp" DisableClientCaching="True" AutoSave="False"
&amp;nbsp;&amp;nbsp;&amp;nbsp; Mode="OnDemand" OutFields="*"/&amp;gt;
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And for my C# code behind I have&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;private void SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
&amp;nbsp; {
&amp;nbsp; FeatureLayer arcgisLayer = Map.Layers["CB"] as FeatureLayer;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcgisLayer.Url = ((ComboBox)sender).Tag as string;&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I based my code on the radio button model from the sample. MY problems are 2 fold. The first is I have set it up to just change the featureLayers currently, however the layers do not change. Also my map is based on slightly differnet base maps and moving foreward i do not see the ability to change both the map url and the FeatureLayer URL.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Nov 2010 19:32:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/using-a-combobox-to-change-map-and-featurelayer/m-p/693208#M17800</guid>
      <dc:creator>WilliamDonahue</dc:creator>
      <dc:date>2010-11-08T19:32:39Z</dc:date>
    </item>
    <item>
      <title>Re: Using a Combobox to change map and featurelayer URLs</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/using-a-combobox-to-change-map-and-featurelayer/m-p/693209#M17801</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The FeatureLayer Url property cannot be changed after the layer has been initialized. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would suggest swapping out the layers themselves rather than Url's. Your ComboBox ItemsSource will then have list of FeatureLayers instead of string URL's. Just update its ItemTemplate to show the either the Url or LayerInfo.Name to identify the layer. On the ComboBox SelectionChanged event, you can add/remove layers to/from your Map.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp; public MainPage()
&amp;nbsp; {
&amp;nbsp;&amp;nbsp; InitializeComponent();

&amp;nbsp;&amp;nbsp; FeatureLayer layer = new FeatureLayer() { Url = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/BloomfieldHillsMichigan/LandusePlanning/FeatureServer/0" };
&amp;nbsp;&amp;nbsp; layer.Initialized += new System.EventHandler&amp;lt;System.EventArgs&amp;gt;(layer_Initialized);
&amp;nbsp;&amp;nbsp; layer.Initialize();
&amp;nbsp;&amp;nbsp; layer = new FeatureLayer() { Url = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/BloomfieldHillsMichigan/LandusePlanning/FeatureServer/1" };
&amp;nbsp;&amp;nbsp; layer.Initialized += new System.EventHandler&amp;lt;System.EventArgs&amp;gt;(layer_Initialized);
&amp;nbsp;&amp;nbsp; layer.Initialize();
&amp;nbsp;&amp;nbsp; this.FeatureLayersCB.ItemsSource = layers;
&amp;nbsp; }

&amp;nbsp; ObservableCollection&amp;lt;FeatureLayer&amp;gt; layers = new ObservableCollection&amp;lt;FeatureLayer&amp;gt;();
&amp;nbsp; void layer_Initialized(object sender, System.EventArgs e)
&amp;nbsp; {
&amp;nbsp;&amp;nbsp; layers.Add(sender as FeatureLayer);
&amp;nbsp; }
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;lt;ComboBox x:Name="FeatureLayersCB" VerticalAlignment="Top" HorizontalAlignment="Center"&amp;gt;
&amp;nbsp;&amp;nbsp; &amp;lt;ComboBox.ItemTemplate&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;DataTemplate&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;TextBlock Text="{Binding LayerInfo.Name}"/&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/DataTemplate&amp;gt;
&amp;nbsp;&amp;nbsp; &amp;lt;/ComboBox.ItemTemplate&amp;gt;
&amp;nbsp; &amp;lt;/ComboBox&amp;gt;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:10:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/using-a-combobox-to-change-map-and-featurelayer/m-p/693209#M17801</guid>
      <dc:creator>JenniferNery</dc:creator>
      <dc:date>2021-12-12T05:10:09Z</dc:date>
    </item>
    <item>
      <title>Re: Using a Combobox to change map and featurelayer URLs</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/using-a-combobox-to-change-map-and-featurelayer/m-p/693210#M17802</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I guess a better question would be. Seeing as how within the applications the primary difference is the symbology would it just be easier to use the script to change symbology for the map. My only problem would then be letting people know what each symbology means.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Nov 2010 13:23:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/using-a-combobox-to-change-map-and-featurelayer/m-p/693210#M17802</guid>
      <dc:creator>WilliamDonahue</dc:creator>
      <dc:date>2010-11-12T13:23:02Z</dc:date>
    </item>
    <item>
      <title>Re: Using a Combobox to change map and featurelayer URLs</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/using-a-combobox-to-change-map-and-featurelayer/m-p/693211#M17803</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Looking over the Samples library would it be possible for me to use the toggle layer visibility function and combine that with a way to change the layer that the editor is pointing at?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Nov 2010 13:29:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/using-a-combobox-to-change-map-and-featurelayer/m-p/693211#M17803</guid>
      <dc:creator>WilliamDonahue</dc:creator>
      <dc:date>2010-11-12T13:29:08Z</dc:date>
    </item>
    <item>
      <title>Re: Using a Combobox to change map and featurelayer URLs</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/using-a-combobox-to-change-map-and-featurelayer/m-p/693212#M17804</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The Editor has LayerIDs property you can update (&lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/webapi/silverlight/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.Editor~LayerIDs.html"&gt;http://help.arcgis.com/en/webapi/silverlight/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.Editor~LayerIDs.html&lt;/A&gt;&lt;SPAN&gt;). However, I can assure you that the Editor will not act on layers that are not visible &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Nov 2010 17:08:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/using-a-combobox-to-change-map-and-featurelayer/m-p/693212#M17804</guid>
      <dc:creator>JenniferNery</dc:creator>
      <dc:date>2010-11-12T17:08:10Z</dc:date>
    </item>
    <item>
      <title>Re: Using a Combobox to change map and featurelayer URLs</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/using-a-combobox-to-change-map-and-featurelayer/m-p/693213#M17805</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I assume that when i use the combo box to change the visible layers i would have to begin my code behind portion with a foreach loop to clear the visible layer first.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Nov 2010 17:37:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/using-a-combobox-to-change-map-and-featurelayer/m-p/693213#M17805</guid>
      <dc:creator>WilliamDonahue</dc:creator>
      <dc:date>2010-11-12T17:37:12Z</dc:date>
    </item>
  </channel>
</rss>

