Skip to main content
All docs
V25.2
  • GridContextMenuDefaultItemNames.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 Grid elements:

    Blazor Grid Context Menu - Supported Regions: Data Row, Footer, Group Footer, Group Panel, Group Row, Header

    Sort Descending is a Grid 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 Grid 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 data row, footer, or group footer context menus. Group panel and group row menus do not support this item and will not display it.
    • 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 Forecast header cell:

    @inject WeatherForecastService ForecastService
    
    <DxGrid Data="@Data"
            ContextMenus="GridContextMenus.Header"
            CustomizeContextMenu="CustomizeContextMenu">
        <Columns>
            <DxGridDataColumn FieldName="Date" DisplayFormat="D" />
            <DxGridDataColumn FieldName="TemperatureC" Caption="@("Temp. (\x2103)")" Width="120px" />
            <DxGridDataColumn FieldName="TemperatureF" Caption="@("Temp. (\x2109)")" Width="120px" />
            <DxGridDataColumn FieldName="Forecast" />
            <DxGridDataColumn FieldName="CloudCover" />
        </Columns>
    </DxGrid>
    
    @code {
        object Data { get; set; }
    
        protected override void OnInitialized() {
            Data = ForecastService.GetForecast();
        }
        void CustomizeContextMenu(GridCustomizeContextMenuEventArgs args) {
            if (args.Context is GridHeaderCommandContext headerContext) {
                if (headerContext.Column is IGridDataColumn dataColumn && dataColumn.FieldName == "Forecast") {
                    args.Items.Remove(GridContextMenuDefaultItemNames.SortColumnDescending);
                }
            }
        }
    }
    
    See Also