ArcGIS Pro 3.8 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / SelectionEnvironment Class / SelectionTolerance Property
Example

In This Topic
    SelectionTolerance Property (SelectionEnvironment)
    In This Topic
    Gets the search tolerance in device units.
    Syntax
    public static int SelectionTolerance {get;}
    Public Shared ReadOnly Property SelectionTolerance As Integer
    Example
    Calculate Selection tolerance in map units
    {
      //Selection tolerance for the map in pixels
      var selectionTolerance = SelectionEnvironment.SelectionTolerance;
      await QueuedTask.Run(() =>
      {
        //Get the map center
        var mapExtent = mapView.Map.GetDefaultExtent();
        var mapPoint = mapExtent.Center;
        //Map center as screen point
        var screenPoint = mapView.MapToScreen(mapPoint);
        //Add selection tolerance pixels to get a "radius".
        var radiusScreenPoint = new System.Windows.Point(screenPoint.X + selectionTolerance, screenPoint.Y);
        var radiusMapPoint = mapView.ScreenToMap(radiusScreenPoint);
        //Calculate the selection tolerance distance in map units.
        var searchRadius = GeometryEngine.Instance.Distance(mapPoint, radiusMapPoint);
      });
    }
    Requirements

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

    ArcGIS Pro version: 3.0 or higher.
    See Also