ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / FeatureLayer Class / GetFeatureDrawOrder Method
Example

In This Topic
    GetFeatureDrawOrder Method
    In This Topic
    Gets the current feature drawing order info. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    Public Function GetFeatureDrawOrder() As List(Of CIMFeatureSortInfo)
    public List<CIMFeatureSortInfo> GetFeatureDrawOrder()

    Return Value

    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run.
    Remarks
    If there is no feature drawing order currently set or if the layer does not support feature drawing order, an empty list is returned
    Example
    Set Feature Drawing Order
    {
        //Within 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);
            }
        }
    }
    Get the Current Feature Drawing Order
    {
        //Within 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()}");
            }
        }
    }
    Requirements

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

    ArcGIS Pro version: 3.6 or higher.
    See Also