ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / FeatureLayer Class / SetFeatureDrawOrder Method / SetFeatureDrawOrder(List<CIMFeatureSortInfo>) Method
The feature sort info to use for drawing order. Can be null
Example

In This Topic
    SetFeatureDrawOrder(List<CIMFeatureSortInfo>) Method
    In This Topic
    Set the layer feature drawing order. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    Public Overloads Sub SetFeatureDrawOrder( _
       ByVal drawingOrder As List(Of CIMFeatureSortInfo) _
    ) 
    public void SetFeatureDrawOrder( 
       List<CIMFeatureSortInfo> drawingOrder
    )

    Parameters

    drawingOrder
    The feature sort info to use for drawing order. Can be null
    Exceptions
    ExceptionDescription
    "Invalid drawing order inputs -check field name(s) exist and/or are the correct field type"
    Layer does not support feature drawing order
    This method or property must be called within the lambda passed to QueuedTask.Run.
    Remarks
    Any existing drawing order will be overwritten. Providing a null or empty drawingOrder list will clear the existing feature drawing order (if any). Internally, GetCanSetFeatureDrawOrder(List<CIMFeatureSortInfo>) is called to determine if the provided drawingOrder can be used.
    Example
    Set Feature Drawing Order 2
    {
        //Within 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);
            }
        }
    }
    Clear the Current Feature Drawing Order
    {
        //Within 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