ArcGIS Pro 3.8 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / BasicFeatureLayer Class / GetCustomSelectionProperties Method
Example

In This Topic
    GetCustomSelectionProperties Method (BasicFeatureLayer)
    In This Topic
    Gets the custom selection properties in use for this layer; that is the flag indicating if a custom selection color is used along with the custom selection color and a flag indication if a custom selection fill color is used along with the custom selection fill color (if the layer is a polygon layer). This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public ValueTuple<bool,CIMColor,bool,CIMColor> GetCustomSelectionProperties()
    Public Function GetCustomSelectionProperties() As ValueTuple(Of Boolean,CIMColor,Boolean,CIMColor)

    Return Value

    A set of a boolean value, a CIMColor value indicating selection color and a boolean and CIMColor indicating selection fill color.
    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run.
    Remarks
    A null custom selection color is returned if the layer is using the default selection color. Null is also returned if custom selection color properties are not supported for the layer type. A null custom selection fill color is returned if the layer is using the default selection fill color. Null is also returned if custom selection color properties are not supported for the layer type. Use SupportsCustomSelectionProperties to determine if the layer supports custom selection color proeprties.
    Example
    Change the layer selection color - using Layer methods
    {
      await QueuedTask.Run(() =>
      {
        if (featureLayer.SupportsCustomSelectionProperties())
        {
        // get the set of properties
        var (useCustomSelectioncolur, customSelectionColor, usecustomSelectioinFilleColor, customSelectionFillColor) = featureLayer.GetCustomSelectionProperties();
    
        // set the layer to use a specific color
        featureLayer.SetCustomSelectionColor(ColorFactory.Instance.RedRGB);
    
        // or set a specific color AND fill color
        featureLayer.SetCustomSelectionColor(ColorFactory.Instance.RedRGB, ColorFactory.Instance.BlueRGB);
    
        // reset to use the default selection color
          featureLayer.SetUseDefaultSelectionColor();
        }
    
        if (!featureLayer.IsVisible)
        {
          featureLayer.SetVisibility(true);
        }
        //Do a selection
        mapView.SelectFeatures(mapView.Extent);
      });
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.8 or higher.
    See Also