ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / MapView Class / SelectFeatures Method
The geometry used to select features that intersect it.
Combination method used in selection operation.
This parameter only applies to 3D. Indicates whether only features that visibly intersect the geometry should be selected.
This parameter only applies to 2D. Indicates whether only features that are completely within the geometry should be selected.
Example

In This Topic
    SelectFeatures Method
    In This Topic
    Select features that intersect a geometry. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    Public Function SelectFeatures( _
       ByVal geometry As Geometry, _
       Optional ByVal method As SelectionCombinationMethod, _
       Optional ByVal isVisualIntersect As Boolean, _
       Optional ByVal isWhollyWithin As Boolean _
    ) As SelectionSet

    Parameters

    geometry
    The geometry used to select features that intersect it.
    method
    Combination method used in selection operation.
    isVisualIntersect
    This parameter only applies to 3D. Indicates whether only features that visibly intersect the geometry should be selected.
    isWhollyWithin
    This parameter only applies to 2D. Indicates whether only features that are completely within the geometry should be selected.

    Return Value

    The map selection created by the intersection with the geometry.
    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run.
    3D views only support selecting features interactively using geometry in screen coordinates relative to the top-left corner of the view.
    Example
    Change the layer selection color
    var featureLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>().FirstOrDefault();
    ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>
    {
      // get the CIM definition of the layer
      var layerDef = featureLayer.GetDefinition() as ArcGIS.Core.CIM.CIMBasicFeatureLayer;
      // disable the default symbol
      layerDef.UseSelectionSymbol = false;
      // assign a new color
      layerDef.SelectionColor = ColorFactory.Instance.RedRGB;
      // apply the definition to the layer
      featureLayer.SetDefinition(layerDef);
    
      if (!featureLayer.IsVisible) 
        featureLayer.SetVisibility(true);
      //Do a selection
    
      MapView.Active.SelectFeatures(MapView.Active.Extent);
    });
    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also