Select to view content in your preferred language

setting active layer

1616
7
09-27-2010 03:12 AM
rohandontireddy
Emerging Contributor
Hoe to set the active layer in arcgis 9.3 silverlight api
0 Kudos
7 Replies
dotMorten_esri
Esri Notable Contributor
What do you mean "active layer" ? The is not such concept as an "active layer" in client APIs.
0 Kudos
rohandontireddy
Emerging Contributor
My Requirement is in my application using arggis 9.3 silverlight api iam showing list of layers here i need to provide option to set the active layer with radio button and visibility using checkboxes.here im unable to set the active layer
0 Kudos
JollyJacob
Emerging Contributor
We also need to set the active layer in the layer list. Pre-silverlight it used to be easy to set. But now it seems that ArcGIS API for Silverlight does not provide that function. Therefore for 'selection' tool, we need to provide a dropdown list of layers from which the user needs to choose the layer from which features are to be selected. Previously, this could be done on the active layer and the user could change this in the Layers tab or leave it as-is if he was selecting frequently from the same layer. Active layer is basically the layer on which selections are made or which is queried.
0 Kudos
ChristineZeller
Occasional Contributor
Jolly Jacob, 
I am looking to do the a very similar thing.  I have a Layer List with check boxes to turn on/off layers...I would love to create a radio button to set the active layer for the select tool but I am also having trouble.  I started to take the same route you just described....."a dropdown list of layers from which the user needs to choose the layer from which features are to be selected."  but I'm also having a little trouble with this.  How are you setting up you code to handle the formatting of the table/grid when a different layer is selected from the dropdown list?  Would you mind sharing your code?

Thanks
Christine.

We also need to set the active layer in the layer list. Pre-silverlight it used to be easy to set. But now it seems that ArcGIS API for Silverlight does not provide that function. Therefore for 'selection' tool, we need to provide a dropdown list of layers from which the user needs to choose the layer from which features are to be selected. Previously, this could be done on the active layer and the user could change this in the Layers tab or leave it as-is if he was selecting frequently from the same layer. Active layer is basically the layer on which selections are made or which is queried.
0 Kudos
dotMorten_esri
Esri Notable Contributor
Use the ESRI.ArcGIS.Client.Editor class and its "Select" command for selection (or the editorwidget), and only set the editors LayerIDs property to the layer you define as the "active layer".
0 Kudos
JollyJacob
Emerging Contributor
Thanks Morten for your help. It appears that the Editor class is available only in ArcGIS 10. We might have to wait till we get 10.

Christine, am not exactly sure what you want help with. The data grid is not being used to populate the dropdown list of layers for selection. In the Layers tab, we are using the Treeview control to display layer list. The below code is being used to populate the dropdown with layers

public void FillMapLayers(ComboBox cmbboxLayers, LayerInfo[] layerInfo, string selectedID)
        {
            try
            {
                cmbboxLayers.Items.Clear();
            }
            catch
            {
                cmbboxLayers.ItemsSource = null;
            }
            ComboBoxItem cmbboxItem;
            for (int i = 0; i < layerInfo.Length; i++)
            {
                if (layerInfo.ID.ToString() != selectedID)
                {
                    if (layerInfo.SubLayerIds == null)
                    {
                        cmbboxItem = new ComboBoxItem();
                        cmbboxItem.Content = layerInfo.Name;
                        cmbboxItem.Tag = layerInfo.ID;

                        cmbboxLayers.Items.Add(cmbboxItem);
                    }
                }
            }
        }
0 Kudos
dotMorten_esri
Esri Notable Contributor
"It appears that the Editor class is available only in ArcGIS 10. We might have to wait till we get 10."

That's not true. Its available only in Silverlight API v2.0. You can still use ArcGIS Server 9.3.x (although you won't be able to edit FeatureLayers, but GraphicsLayers and selection will still be good to go)
0 Kudos