Solved! Go to Solution.
Where = string.Format("CNAME LIKE '%{0}%'", FindText.Text),instead of the sql string you helped with, accompanied with a FindText box and it returns reuslts. The erro message has given something interesting though.
private void CountiesDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e) { foreach (Graphic g in e.AddedItems) { g.Select(); TabletMap.ZoomTo(g.Geometry); } foreach (Graphic g in e.RemovedItems) g.UnSelect(); }
private void RunWestTexasCountyQuery() { ClearAllGraphics(); GraphicsLayer searchGraphicsLayer = TabletMap.Layers["SearchGraphicsLayer"] as GraphicsLayer; ESRI.ArcGIS.Client.Tasks.Query query = new ESRI.ArcGIS.Client.Tasks.Query() { ReturnGeometry = true, OutSpatialReference = TabletMap.SpatialReference, Where = "CNAME IN ('CULBERSON', 'JEFF DAVIS', 'LOVING', 'REEVES', 'WARD', 'WINKLER')" }; query.OutFields.Add("CNAME"); QueryTask queryTask = new QueryTask("<serviceURL>"); queryTask.ExecuteCompleted += (s, a) => { foreach (Graphic g in a.FeatureSet.Features) searchGraphicsLayer.Graphics.Add(g); }; queryTask.ExecuteAsync(query); queryTask.Failed += QueryTask_Failed; } private void QueryTask_Failed(object sender, TaskFailedEventArgs args) { MessageBox.Show("Query execute error: " + args.Error); } private void BookmarksDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e) { foreach (ESRI.ArcGIS.Client.Graphic g in e.AddedItems) { g.Select(); TabletMap.ZoomTo(g.Geometry); } foreach (ESRI.ArcGIS.Client.Graphic g in e.RemovedItems) g.UnSelect(); }
object obj = e.AddedItems[0]; //This bit of trickery is from a post that Jennifer made on the forum to convert the SelectedItem to a graphic using reflection MethodInfo methodInfo = obj.GetType().GetMethod("GetGraphicSibling"); if ( methodInfo == null ) return; Graphic g = methodInfo.Invoke(obj, null) as Graphic;
private void BookmarksDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e) { object obj = e.AddedItems[0]; //This bit of trickery is from a post that Jennifer made on the forum to convert the SelectedItem to a graphic using reflection MethodInfo methodInfo = obj.GetType().GetMethod("GetGraphicSibling"); if (methodInfo == null) return; Graphic g = methodInfo.Invoke(obj, null) as Graphic; foreach (Graphic g in e.AddedItems) { g.Select(); TabletMap.ZoomTo(g.Geometry); } foreach (Graphic g in e.RemovedItems) g.UnSelect(); }
private static Graphic GetGraphicSibling(object item) { if (item != null) { MethodInfo mi = item.GetType().GetMethod("GetGraphicSibling"); if (mi != null) return mi.Invoke(item, null) as Graphic; } return null; } private void BookmarksDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e) { foreach (var item in e.AddedItems) { var g = GetGraphicSibling(item); g.Select(); TabletMap.ZoomTo(g.Geometry); } foreach (var item in e.RemovedItems) { var g = GetGraphicSibling(item); g.UnSelect(); } }