コード例 #1
0
        private void MyDrawSurface_DrawComplete(object sender, ESRI.ArcGIS.Client.DrawEventArgs args)
        {
            ResultsDisplay.Visibility = Visibility.Collapsed;
            MyDrawObject.IsEnabled    = false;
            selectionGraphicslayer.Graphics.Clear();

            QueryTask queryTask = new QueryTask("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/5");

            queryTask.ExecuteCompleted += QueryTask_ExecuteCompleted;
            queryTask.Failed           += QueryTask_Failed;

            // Bind data grid to query results
            Binding resultFeaturesBinding = new Binding("LastResult.Features");

            resultFeaturesBinding.Source = queryTask;
            QueryDetailsDataGrid.SetBinding(DataGrid.ItemsSourceProperty, resultFeaturesBinding);
            Query query = new ESRI.ArcGIS.Client.Tasks.Query();

            // Specify fields to return from query
            query.OutFields.AddRange(new string[] { "STATE_NAME", "SUB_REGION", "STATE_FIPS", "STATE_ABBR", "POP2000", "POP2007" });
            query.Geometry = args.Geometry;

            // Return geometry with result features
            query.ReturnGeometry      = true;
            query.OutSpatialReference = MyMap.SpatialReference;

            queryTask.ExecuteAsync(query);
        }
コード例 #2
0
 private void GraphicsLayer_MouseEnter(object sender, GraphicMouseEventArgs args)
 {
     QueryDetailsDataGrid.Focus();
     QueryDetailsDataGrid.SelectedItem  = args.Graphic;
     QueryDetailsDataGrid.CurrentColumn = QueryDetailsDataGrid.Columns[0];
     QueryDetailsDataGrid.ScrollIntoView(QueryDetailsDataGrid.SelectedItem, QueryDetailsDataGrid.Columns[0]);
 }
コード例 #3
0
        private void MyDrawSurface_DrawComplete(object sender, ESRI.ArcGIS.Client.DrawEventArgs args)
        {
            GraphicsLayer selectionGraphicslayer = Map.Layers["MySelectionGraphicsLayer"] as GraphicsLayer;

            selectionGraphicslayer.ClearGraphics();

            // Bind data grid to query results
            Binding resultFeaturesBinding = new Binding("LastResult.Features");

            resultFeaturesBinding.Source = _queryTask;
            QueryDetailsDataGrid.SetBinding(DataGrid.ItemsSourceProperty, resultFeaturesBinding);

            Query query = new ESRI.ArcGIS.Client.Tasks.Query();

            query.OutFields.AddRange(new string[] { "state_name", "pop2000", "sub_region" });
            query.OutSpatialReference = Map.SpatialReference;
            query.Geometry            = args.Geometry;
            query.SpatialRelationship = SpatialRelationship.esriSpatialRelIntersects;
            query.ReturnGeometry      = true;

            _queryTask.ExecuteAsync(query);
        }
コード例 #4
0
        private void MyDrawSurface_DrawComplete(object sender, ESRI.ArcGIS.Client.DrawEventArgs args)
        {
            ResultsDisplay.Visibility = Visibility.Collapsed;
            MyDrawObject.IsEnabled    = false;
            selectionGraphicslayer.Graphics.Clear();

            // Bind data grid to query results
            Binding resultFeaturesBinding = new Binding("LastResult.Features");

            resultFeaturesBinding.Source = MyQueryTask;
            QueryDetailsDataGrid.SetBinding(DataGrid.ItemsSourceProperty, resultFeaturesBinding);

            Query query = new ESRI.ArcGIS.Client.Tasks.Query();

            query.OutFields.AddRange(new string[] { "STATE_NAME", "POP2000", "SUB_REGION" });
            query.OutSpatialReference = MyMap.SpatialReference;
            query.Geometry            = args.Geometry;
            query.SpatialRelationship = SpatialRelationship.esriSpatialRelIntersects;
            query.ReturnGeometry      = true;

            MyQueryTask.ExecuteAsync(query);
        }
コード例 #5
0
 private void GraphicsLayer_MouseLeave(object sender, GraphicMouseEventArgs args)
 {
     QueryDetailsDataGrid.Focus();
     QueryDetailsDataGrid.SelectedItem = null;
 }