I am trying to populate a data grid with the records from a shapefile or feature service. However, when I set the shapefile/feature service to the item source for the datagrid, I only seem to get the metadata and not the attributes contained in the shapefile (i.e. I get three columns: 'Schema','Attributes','Geometry'). Does anybody know how I can get the attribute columns to populate the datagrid? I am using the code below:
private async void QueryEQ_Click(object sender, RoutedEventArgs e)
{
//Query the Earthquake layer for quakes with a magnitude greater than defined by the user
var featureSvcTable = await Esri.ArcGISRuntime.Data.ServiceFeatureTable.OpenAsync(new Uri("http://igems.doi.gov/arcgis/rest/services/igems_haz/mapserver/3"));
var query = new Esri.ArcGISRuntime.Data.QueryFilter();
query.WhereClause = string.Format("magnitude >= {0}",QueryIO.Text);
var result = await featureSvcTable.QueryAsync(query);
//Take query and populate graphics layer
var gLayer = MyMapView.Map.Layers["EQs"] as GraphicsLayer;
gLayer.Graphics.Clear();
foreach (var f in result)
{
var g = new Graphic(f.Geometry, f.Attributes);
gLayer.Graphics.Add(g);
}
//Add query result to the data grid table
MyFeatureDataTable.ItemsSource = result;
}