Select to view content in your preferred language

FeatureLayerSelection - adding display selected features attributes panel

524
2
09-27-2010 10:22 AM
BrianPangtay
Regular Contributor
I like the sample below for selecting features. I altered the sample so that I can choose between the different SelectionModes.

http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#FeatureLayerSelection

However, how do I display the attributes of the selected features like in the Spatial Query sample?

http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#SpatialQuery

The first sample doesn't trigger a QueryCompleted event and the second sample uses the event.

Thanks for your help.
0 Kudos
2 Replies
JenniferNery
Esri Regular Contributor
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.
     }
     
    }
   }
  }
0 Kudos
dotMorten_esri
Esri Notable Contributor
Can't you just use the FeatureDataGrid and bind it to the layer?
0 Kudos