Layer Attributes


Purpose
This sample demonstrates how to use the TableBindingAdapter class to bind a Table to a .NET DataGridView control, so that attribute data can be easily displayed in a tabular format.  Additionally it also demonstrates how to zoom to the location of a record and work with the map's graphics collection to add and remove graphics.  Logic has been added, by listening to Application events, to ensure that the list of feature layers stays synchronized with those in the Contents window and that open attribute tables are closed if a map document is closed.

How to use

See Using the samples for help on compiling, setting up the debugger, and running the sample. If the sample has associated data, you will find that the sample's zip file includes a "data" folder alongside the language folders. However, you will need to update the sample to point to the location of the data once you have extracted all the files.

  1. Open and build the solution in Visual Studio.
  2. Open ArcGIS Explorer, and open a map which contains some feature layers or use the 'Add Content' button to add shapefiles or geodatabase feature classes.
  3. Select the Add-Ins tab from the ArcGIS Explorer ribbon.
  4. Click the 'Layer Attributes' button to open the dockable window.
  5. Select a layer from the list and double-click on it to open a form displaying attribute data.
  6. Select a record in the DataGridView control and click the 'Zoom to feature' button.
  7. The 'Show graphic for feature' button should be enabled, click it to add a graphic to the map for this record.
  8. Click the 'Clear graphic for feature' button to remove the graphic for the selection.
  9. Add graphics for several rows, then use the 'Remove all table graphics' to clear all graphics for this table.


  10. Layer attribute sample map


Download the files for all languages
LayerAttributesDockWindow.cs This class defines the dockable window and displays a list of all the feature layers in the map.
LayerAttributesForm.cs This class defines a .NET windows form containing a DataGridView control, BindingNavigator component and a BindingSource component. The table binding, using the TableBindingAdapter, is performed in the form's constructor.
Download the C# files
LayerAttributesDockWindow.vb This class defines the dockable window and displays a list of all the feature layers in the map.
LayerAttributesForm.vb This class defines a .NET windows form containing a DataGridView control, BindingNavigator component and a BindingSource component. The table binding, using the TableBindingAdapter, is performed in the form's constructor.
Download the VB.NET files

See Also:

TableBindingAdapter