Custom selection extension


Purpose
This sample demonstrates how to create a complete add-in. The sample is based around a selection theme but its purpose is to demonstrate multiple add-in components working together. This add-in contains an extension, a dockview, a toolbar with several buttons and tools, and a menu. All components are disabled until the extension is selected on the Extensions dialog box. The extension does not load until it needs to (it delay loads). Similarly, the dockview only gets created once the Toggle DockView button is clicked.
 
This sample has also been localized to Chinese(PRC).

How to use

See How to use ArcGIS 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. In Visual Studio, click the Build menu and click Build Solution.
  2. Load some data in ArcMap.
  3. Click the Customize menu, click Toolbars, then choose the Selection Add-In toolbar. (See the second screen shot for the Selection AddIn toolbar.)
  4. Click the Customize menu and click Extensions. Select the Selection Sample Extension check box on the Extensions dialog box. (See the first screen shot.)
  5. Make a selection using one of the tools.
  6. Optionally, use the combo box to choose target selection layers.
  7. Optionally, click the Zoom to layer menu to zoom to a selected layer.
  8. The dockable window will report selected features count. (See the second screen shot for the highlighted dockable window.)
  9. Use the toggle button to toggle the dockable window. The button is highlighted in a yellow box on the second screen shot.
  10. To see the localized version, change the format to Chinese(PRC) on the Regional and Language Options dialog box (accessed from the Control Panel).


  11. Screen shot of the Extensions dialog box.


    Screen shot of ArcMap showing the custom toolbar and dockable window.

SelCountDockWin.cs Dockable window implementation.
SelectByLineTool.cs A selection tool.
SelectionExtension.cs Main extension.
ToggleDockWinBtn.cs Button to toggle the dockable window.
Config.esriaddinx Add-in's declarations.
SelectionTargetComboBox.cs A combo box containing target layers.
ZoomToLayerMultiItem.cs A multiItem containing layers.
Download the C# files
SelCountDockWin.vb Dockable window implementation.
SelectByLineTool.vb A selection tool.
SelectionExtension.vb Main extension.
ToggleDockWinBtn.vb Button to toggle the dockable window.
Config.esriaddinx Add-in's declarations.
SelectionTargetComboBox.vb A combo box containing target layers.
ZoomToLayerMultiItem.vb A multiItem containing layers.
Download the VB.NET files

Download the files for all languages




Development licensing Deployment licensing
ArcView ArcView
ArcEditor ArcEditor
ArcInfo ArcInfo