实现点查询并绑定到datagrid
时间:2011-02-25 来源:hl3292
ArcGIS Web Mapping for Silverlight开发入门之9:属性查询、定位、标注-转载
原文地址http://blog.csdn.net/FlexMapServer/archive/2010/12/09/6065260.aspx
void QueryTask_ExecuteCompleted(object sender, ESRI.ArcGIS.Client.Tasks.QueryEventArgs args) { FeatureSet featureSet = args.FeatureSet; if (featureSet != null && featureSet.Features.Count > 0) { List<QueryResultData> resultList = new List<QueryResultData>(); foreach (Graphic feature in featureSet.Features) { resultList.Add(new QueryResultData() { POLYGON_ID = feature.Attributes["POLYGON_ID"].ToString(), CN_NAME = feature.Attributes["CN_NAME"].ToString(), CN_PY = feature.Attributes["CN_PY"].ToString(), }); } QueryDetailsDataGrid.ItemsSource = resultList; } else { MessageBox.Show("No features returned from query"); } } private void QueryTask_Failed(object sender, TaskFailedEventArgs args) { MessageBox.Show("Query execute error: " + args.Error); } public class QueryResultData { public string POLYGON_ID { get; set; } public string CN_NAME { get; set; } public string CN_PY { get; set; } }
第二部分
hl3292的实现方法
相关阅读 更多 +