Skip to main content
All docs
V25.2
  • TreeListContextMenuDefaultItemNames.SortColumnDescending Field

    The Sort Descending item’s name.

    Namespace: DevExpress.Blazor

    Assembly: DevExpress.Blazor.v25.2.dll

    NuGet Package: DevExpress.Blazor

    Declaration

    public const string SortColumnDescending = "SortColumnDescending"

    Field Value

    Type Description
    String

    The “SortColumnDescending” string.

    Remarks

    Specify the ContextMenus property to display context menus for the following TreeList elements:

    Blazor TreeList Context Menu - Supported Regions: Data Row, Footer, Header

    Sort Descending is a TreeList context menu item that sorts the target column in descending order. This item is available in a header context menu only if sorting is enabled at both TreeList and column levels. The item is disabled when the target column is already sorted in descending order.

    Use the SortColumnDescending field to apply the following customizations:

    • Access and customize the Sort Descending item
    • Add this item to a context menu
    • Remove the item from the header context menu

    Example

    The following code snippet removes the Sort Column Descending command from the context menu associated with the Due Date column:

    @inject EmployeeTaskService EmployeeTaskService
    
    <DxTreeList Data="TreeListData"
                KeyFieldName="Id"
                ParentKeyFieldName="ParentId"
                ContextMenus="TreeListContextMenus.All"
                CustomizeContextMenu="CustomizeContextMenu">
        <Columns>
            <DxTreeListSelectionColumn Width="80px" />
            <DxTreeListDataColumn FieldName="Name" Caption="Task" />
            <DxTreeListDataColumn FieldName="EmployeeName" />
            <DxTreeListDataColumn FieldName="StartDate" />
            <DxTreeListDataColumn FieldName="DueDate" />
        </Columns>
    </DxTreeList>
    
    @code {
        List<EmployeeTask> TreeListData { get; set; }
    
        protected override void OnInitialized() {
            TreeListData = EmployeeTaskService.GenerateData();
        }
        void CustomizeContextMenu(TreeListCustomizeContextMenuEventArgs args) {
            if (args.Context is TreeListHeaderCommandContext headerContext) {
                if (headerContext.Column is ITreeListDataColumn dataColumn && dataColumn.FieldName == "DueDate") {
                    args.Items.Remove(TreeListContextMenuDefaultItemNames.SortColumnDescending);
                }
            }
        }
    }
    
    See Also