In the SpatialQuery example, the query task is created and executed after MyDrawSurface_DrawComplete. If you would like to do the same in the LayerSelection example, you will need to tap into the Editor's EditCompleted event. You also may want to use FeatureDataGrid using featureLayer.SelectedGraphics as its FilterSource.
public MainPage()
{
InitializeComponent();
Editor editor = this.LayoutRoot.Resources["MyEditor"] as Editor;
if (editor!=null)
editor.EditCompleted += new EventHandler<Editor.EditEventArgs>(editor_EditCompleted);
}
void editor_EditCompleted(object sender, Editor.EditEventArgs e)
{
if (e.Action == Editor.EditAction.Select)
{
foreach (var edit in e.Edits)
{
if (edit.Layer is FeatureLayer)
{
FeatureLayer featureLayer = edit.Layer as FeatureLayer;
//TODO: display featureLayer.SelectedGraphics in a grid.
}
}
}
}