Dim featureSet As FeatureSet = args.FeatureSet Dim graphicsLayer As GraphicsLayer = TryCast(MyMap.Layers("MyGraphicsLayer"), GraphicsLayer) For Each feature As Graphic In featureSet.Features graphicsLayer.Graphics.Insert(0, feature) Next Dim env As New ESRI.ArcGIS.Client.Geometry.Envelope env.XMax = graphicsLayer.FullExtent.XMax env.XMin = graphicsLayer.FullExtent.XMin env.YMax = graphicsLayer.FullExtent.YMax env.YMin = graphicsLayer.FullExtent.YMin MyMap.ZoomTo(env)
Solved! Go to Solution.
MyMap.ZoomTo(graphicsLayer.FullExtent);
<Grid x:Name="LayoutRoot" Background="White"> <esri:Map x:Name="myMap" WrapAround="True"> <esri:ArcGISTiledMapServiceLayer ID="baseMap" Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" /> </esri:Map> </Grid>
public MainPage() { InitializeComponent(); QueryTask queryTask = new QueryTask("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Fire/Sheep/MapServer/0"); Query query = new Query() { Where = "1=1", ReturnGeometry = true, OutSpatialReference = myMap.SpatialReference }; queryTask.ExecuteCompleted += (s, e) => { var l = new GraphicsLayer(); foreach (var r in e.FeatureSet.Features) l.Graphics.Add(r); System.Diagnostics.Debug.WriteLine(l.FullExtent); }; queryTask.ExecuteAsync(query); }