Select to view content in your preferred language

Findtask datagrid display

729
2
08-25-2011 10:17 AM
gabrielvazquez
Deactivated User
I am using a findtask to query a layer. Similiar to the this example http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#Find . I am also trying to export all of the query result fields to datagrid, as is done in the example. However, I am not sure how to export all of the data field results to the datagrid using the findtask.

I can do it easily with a querytask, similar to this example http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#QueryWithoutMap. However I'm not sure how to get all of layer data from a findtask to populate the featuredatagrid.

I have the Findtask results bound to the datagrid, however the datagrid just comes up blank. Not sure if this has to do with the fact that I am not defining any output fields, as is done with a querytask "query.OutFields.Add("*");" or if there is some other specific syntax I am missing.

I thought it would be something as simple as using datagrid.Itemsource = args.FindResults; However that does not work also, if someone has any experience with data grids, and importing FindTask results, please let me know.
0 Kudos
2 Replies
JenniferNery
Esri Regular Contributor
If you want to use FeatureDataGrid to display results of your tasks, you can use GraphicsLayer to add/remove Graphics in your ExecuteCompleted event handler and be sure to set Map and GraphicsLayer property in XAML, as seen below:
  <esri:FeatureDataGrid Grid.Row="2" x:Name="MyDataGrid"
    Map="{Binding ElementName=MyMap}"
    GraphicsLayer="{Binding ElementName=MyMap, Path=Layers.[MyGraphicsLayer]}" />
0 Kudos
gabrielvazquez
Deactivated User
Jennifer,
Thank you very much. Such a simple fix. I forget that I could enable an ESRI FeatureDataGrid in the XAML. I was using an windows data grid and trying to apply it within the C# code.

That helped.
0 Kudos