Also, I debug into it, prior to adding to the map layers collection, and I see the "Graphics" collection is empty:
if (LayerComboBox.SelectedItem != "Select...") { FeatureLayer queryLayer = new FeatureLayer(); string layerComboBoxItem; string layerID; layerComboBoxItem = LayerComboBox.SelectedItem.ToString(); layerID = GetLayerID(layerComboBoxItem).ToString(); queryLayer.ID = "QueryLayer"; queryLayer.Url = "http://......./rest/services/QueryLayerService/MapServer/" + layerID; queryLayer.OutFields.Add("*"); MyMap.Layers.Add(queryLayer); queryLayer.Initialize(); } }
QueryFormCombo1.ItemsSource = (MyMap.Layers["QueryLayer"] as FeatureLayer).LayerInfo.Fields;