This document is archived and information here might be outdated.  Recommended version.


IFeatureSelection Interface (ArcObjects .NET 10.6 SDK)
ArcObjects Help for .NET developers > ArcObjects namespaces > Carto > ESRI.ArcGIS.Carto > Interfaces > IF > IFeatureSelection Interface (ArcObjects .NET 10.6 SDK)
ArcObjects Library Reference (Carto)  

IFeatureSelection Interface

Provides access to members that control feature selection.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Members

Name Description
Method Add Adds a feature to the selection set.
Read/write property BufferDistance Buffer distance used for the selection.
Method Clear Clears the selection.
Read/write property CombinationMethod Combination method for the selection.
Method SelectFeatures Selects features based upon the specifed criteria and combination method.
Method SelectionChanged Fires the features layer update event. Required when SelectionSet changes.
Read/write property SelectionColor Selection color. (used when SetSelectionSymbol=FALSE).
Read/write property SelectionSet The selected set of features.
Read/write property SelectionSymbol Selection symbol.
Read/write property SetSelectionSymbol Indicates if the selected set of features is drawn using the SelectionSymbol.

CoClasses that implement IFeatureSelection

CoClasses and Classes Description
CadAnnotationLayer An Esri Cad annotation layer.
CadastralFabricSubLayer Cadastral Fabric Feature Layer Object.
CadFeatureLayer Esri CAD Feature Layer class.
CoverageAnnotationLayer An Esri coverage annotation layer.
DimensionLayer A collection of properties for a dimension layer.
FDOGraphicsLayer A collection of properties for an annotation layer (feature data object graphics layer).
FeatureLayer A collection of features and their visual representation.
GdbRasterCatalogLayer Geodabase RasterCatalog source and display options.
ImageServerLayer Image server layer source and display options.
IMSSubFeatureLayer A collection of IMS features as a sublayer of an IMSMapLayer.
TemporalFeatureLayer (esriTrackingAnalyst) Defines the coclass IDL parameters and attributes of the TemporalFeatureLayer COM object.

Remarks

IFeatureSelection is a very useful interface to manage or perform selection on a layer or to modify the way the selection is displayed.

The following methods and properties are useful to manage the selection:

The CombinationMethod property is not used.
SelectionSet returns a SelectionSet corresponding to the current selection on the layer.
Clear will clear an existing selection.
Add adds one single feature to the selection.
SelectFeatures will perform a selection based on a query filter. If nothing is used as a query filter all the features will be selected. You can also specify a combination method. The justOne parameter tells the search to stop once it has found one feature.
Call SelectionChanged after modifying SelectionSet to fire update events on the layer.

The following methods and properties are useful to modify the way the selection is displayed:

SelectionSymbol will return or set the symbol used to display selected features on the layer.
SetSelectionSymbol is a boolean used to indicate if the SelectionSymbol is used or not to draw the selection. For feature layers, this is similar to using the "Show selected features...with this symbol" option in the layer properties.
SelectionColor is equivalent to using the "Show selected features...with this color" option in the layer properties.
If BufferDistance is set to a value greater than 0, a buffer will be drawn around the selected features. This is similar to using the Buffer Selection tool that can be added to the map with the Customize command found in the Tools menu.

.NET Snippets

Clear Selected Map Features | Select Map Features by Attribute Query | Zoom to Selected Globe Features

.NET Samples

Custom reshape polyline edit task (Code Files: ReshapePolylineEditTask) | Selection restriction evaluator (Code Files: SelectionRestrictionEvaluator) | Executing geoprocessing tools in the background (Code Files: RunGPForm) | Custom vertex editing commands (Code Files: CustomVertexCommands UsingOutOfBoxVertexCommands) | ArcGIS Network Analyst extension barrier location editor (Code Files: NABarrierLocationEditor) | Custom selection extension (Code Files: SelectionExtension) | Create camera flyby from path (Code Files: frmCameraPath) | Create a custom selection extension by extending ArcObjects (Code Files: SelectionExtension)

.NET Related Topics

How to create a selection set using a scatter plot graph | How to zoom to selected features in globe | Performing map selection