AnsweredAssumed Answered

Issue on Getting Attributes at Query Only in ArcGIS Runtime SDK for .NET

Question asked by behClevest on Mar 31, 2017
Latest reply on Mar 31, 2017 by GDeStigter-esristaff

Trying to Query an ESRI MapService through ArcGIS Runtime .NET SDK 10.2.7 (Using this sample)

 

 private async void QueryButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                await RunQuery();
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message, "Error");
            }
        }
        private async Task RunQuery()
        {
            try
            {
                QueryTask queryTask = new QueryTask(
                    new Uri("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/5"));

                Query query = new Query(StateNameTextBox.Text);
                query.OutFields.Add("STATE_NAME");

                var result = await queryTask.ExecuteAsync(query);
               itemListView.ItemsSource = result.FeatureSet.Features.OrderBy(g => g.Attributes["STATE_NAME"]);
            }
            catch (TaskCanceledException) { }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error");
            }
        }
    }

but in result I am getting Esri.ArcGISRuntime.Layers.Graphic instead of the name of the states!

 

Can you please let me know why this is happening and how can I fix it?

Outcomes