I am wanting to use the FeatureDataGrid to display data. The problem is I have more than one layer that contains data that needs to be displayed.

This is how you use the DataGrid for one layer:

private void MyMap_Loaded(object sender, RoutedEventArgs e)
            MyDataGrid.Map = MyMap;
            MyDataGrid.GraphicsLayer = MyMap.Layers[1] as ESRI.ArcGIS.Client.GraphicsLayer;
            MyFeatureDataForm.FeatureLayer = MyMap.Layers[1] as ESRI.ArcGIS.Client.FeatureLayer;

This is the XAML for my map:

                    <esri:ArcGISTiledMapServiceLayer ID="MyLayer" Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"/>

                    <esri:FeatureLayer ID="Hydrant" 
                                       Renderer="{StaticResource Renderer_Hydrant}"
                                       OutFields="*" />
                    <esri:FeatureLayer ID="WaterValves" 
                                       Renderer="{StaticResource Renderer_WaterValves}"
                                       OutFields="*" />
                    <esri:GraphicsLayer ID="CandidateGraphicsLayer">
                                <Rectangle Stroke="Gray"  RadiusX="10" RadiusY="10" Fill="#77FF0000" Margin="0,0,0,5" >
                                <Rectangle Fill="#DDFFFFFF" Stroke="DarkGray" RadiusX="5" RadiusY="5" Margin="10,10,10,15" />
                                <StackPanel Orientation="Vertical" HorizontalAlignment="Center" Margin="30,20,30,30">
                                    <TextBlock Text="{Binding [Address]}" HorizontalAlignment="Left" Foreground="Black" />

I thought about trying to pull the layer for the selected graphic, but I am not sure as to how to do that. If you need any more information or want me to explain further, let me know.

  • In this case, do you need to show data on all the hydrants, watervalves, and address results in the map extent, or some combination of those?
    – raykendo
    Jul 1, 2013 at 20:35
  • Just the hydrant and watervalves. My feature layers. I need the data to show in the featuredatagrid. Right now it will only show one of the other.
    – JLott
    Jul 1, 2013 at 20:45

1 Answer 1


The FeatureDataGrid is connected to a single GraphicsLayer or FeatureLayer (which inherits from GraphicsLayer), and uses the attributes to autogenerate column names. Mixing two layers that (probably) have different column names would look confusing on a single table, since some records would fill in some columns, and other records wouldn't. I think that's why the FeatureDataGrid enforces binding to a single layer.

That being said, if you need to show data for two FeatureLayers at the same time, use two FeatureDataGrids, each one bound to a different layer. If you don't have enough room on the screen, I'd recommend a TabControl with a FeatureDataGrid in each TabItem.

Or, you could have a single FeatureDataGrid and a ComboBox or RadioButtons that let you switch the FeatureDataGrid's GraphicsLayer and FeatureLayer between the two layers.

  • The combobox/radiobutton idea is great! I should have thought of that. Do you know if there is a way to tell which feature layer a graphic is associated with when the user clicks on it? I thought about setting the feature layer property of the FeatureDataGrid to the feature layer of the graphic selected, but I am not sure about how to go about that.
    – JLott
    Jul 2, 2013 at 13:23
  • For each FeatureLayer, Create a MouseLeftButtonDown event handler that sets the feature layer property of the FeatureDataGrid to that FeatureLayer. The MouseLeftButtonDown event will trigger when you click on a graphic in the FeatureLayer, and it has access to the graphic you clicked. MouseLeftButtonDown Event: resources.arcgis.com/en/help/runtime-wpf/apiref/…
    – raykendo
    Jul 2, 2013 at 16:02
  • I love when I just look over simple solutions. Thanks again!
    – JLott
    Jul 2, 2013 at 17:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.