ArcGIS Pro 3.8 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / FeatureLayer Class / GetIsFeatureDrawOrderSupported Method
Example

In This Topic
    GetIsFeatureDrawOrderSupported Method (FeatureLayer)
    In This Topic
    Gets whether or not feature drawing order is supported on the layer. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public virtual bool GetIsFeatureDrawOrderSupported()
    Public Overridable Function GetIsFeatureDrawOrderSupported() As Boolean

    Return Value

    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run.
    Example
    Check Whether Feature Drawing Order is Supported
    {
      var supportsFeatureDrawOrder = await QueuedTask.Run(() =>
        featureLayer.GetIsFeatureDrawOrderSupported());
    }
    Set Feature Drawing Order
    {
      await QueuedTask.Run(() =>
      {
        if (featureLayer.GetIsFeatureDrawOrderSupported())
        {
          //Provide the field name to use and the sort ordering
          //The field must exist on the layer. Check the field can be used first
          if (featureLayer.GetCanSetFeatureDrawOrder("Police_Precinct", SortOrderType.Ascending))
          {
            //Set the FDO to use the "Police_Precinct" field and ascending sort order
            featureLayer.SetFeatureDrawOrder("Police_Precinct", SortOrderType.Ascending);
          }
        }
      });
    }
    Set Feature Drawing Order 2
    {
      await QueuedTask.Run(() =>
      {
      if (featureLayer.GetIsFeatureDrawOrderSupported())
      {
        var listOfSortInfo = new List<CIMFeatureSortInfo>
                  {
                      //Draw features in the layer ordered by Police_Precinct field in ascending order
                      //and then by Crime_rate field in descending order
                      new CIMFeatureSortInfo
                      {
                          FieldName = "Police_Precinct",
                          SortDirection = SortOrderType.Ascending
                      },
                      new CIMFeatureSortInfo
                      {
                          FieldName = "Crime_rate",
                          SortDirection = SortOrderType.Descending
                      }
                  };
        //Provide the list of FSOs to use and their sort ordering
        //All fields must exist on the layer.
        if (featureLayer.GetCanSetFeatureDrawOrder(listOfSortInfo))
        {
          //Set the FDO to use the list of FSOs
          featureLayer.SetFeatureDrawOrder(listOfSortInfo);
        }
      }
      });
    }
    Get the Current Feature Drawing Order
    {
      await QueuedTask.Run(() =>
      {
      if (featureLayer.GetIsFeatureDrawOrderSupported())
      {
        var cimFeatSortInfo = featureLayer.GetFeatureDrawOrder();
        var c = 0;
        System.Diagnostics.Debug.WriteLine("Feature Sort Info:");
        foreach (var fs_info in cimFeatSortInfo)
        {
          System.Diagnostics.Debug.WriteLine(
            $"fs_info[{c++}] {fs_info.FieldName}: {fs_info.SortDirection.ToString()}");
        }
      }
      });
    }
    Clear the Current Feature Drawing Order
    {
      await QueuedTask.Run(() =>
      {
      if (featureLayer.GetIsFeatureDrawOrderSupported())
      {
        //will throw an InvalidOperation exception if the layer does
        //not support FDO
        featureLayer.ClearFeatureDrawOrder();
        //Passing an empty or null list to 'SetFeatureDrawOrder()' will also clear the FDO
        featureLayer.SetFeatureDrawOrder(new List<CIMFeatureSortInfo>());
        //or
        featureLayer.SetFeatureDrawOrder(null);
      }
      });
    }
    Requirements

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

    ArcGIS Pro version: 3.6 or higher.
    See Also