private void QueryTask_ExecuteCompleted(object sender, ESRI.ArcGIS.Client.Tasks.QueryEventArgs args)
{
FeatureSet featureSet = args.FeatureSet;
// If initial query to populate states combo box
if ((args.UserState as string) == "initial")
{
// Just show on initial load
QueryComboBox.Items.Add("Select...");
foreach (Graphic graphic in args.FeatureSet.Features)
{
QueryComboBox.Items.Add(graphic.Attributes["NAMN"].ToString());
}
QueryComboBox.SelectedIndex = 0;
return;
}private static string GetValue(DataGridColumn col, Graphic graphic)
{
if (col is DataGridBoundColumn)
{
DataGridBoundColumn column = col as DataGridBoundColumn;
if ((column.Binding != null) && (column.Binding.Path != null))
{
string path = column.Binding.Path.Path;
if (!string.IsNullOrEmpty(path))
{
var att = Regex.Replace(path, ".*\\[(.*)\\]", "$1");
return graphic.Attributes[path] == null ? string.Empty : graphic.Attributes[path].ToString();
}
}
}
return string.Empty;
}