Is This Content Helpful?
We're glad to know this article was helpful.
Instructions provided explain how to update a datagrid dynamically with the query results, without hard-coding attribute names, similar to the Attribute Query Sample.
Building on to the existing sample, the datagrid is populated at runtime without any hard-coded column names.
QueryDetailsDataGrid.ItemsSource = selectedFeature.Attributes;
var dictionary1 = selectedFeature.Attributes as IDictionary;
foreach (DictionaryEntry pair in dictionary1)
var str = "Attributes[" + pair.Key.ToString() + "]";
Header = pair.Key,
Binding = new Binding(str)
<slData:DataGrid x:Name="QueryDetailsDataGrid" AutoGenerateColumns="True" Background="White"/>