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

    The Hide Column item’s name.

    Namespace: DevExpress.Blazor

    Assembly: DevExpress.Blazor.v25.2.dll

    NuGet Package: DevExpress.Blazor

    Declaration

    public const string HideColumn = "HideColumn"

    Field Value

    Type Description
    String

    The “HideColumn” 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

    Hide Column is a TreeList context menu item that hides the target column. This item is available in the header context menu.

    Use the HideColumn field to apply the following customizations:

    • Access and customize the Hide Column item
    • Add this item to a cotext menu
    • Remove the item from the header context menu

    Example

    The following code snippet removes the Hide Column command from the context menu associated with the Task column:

    @inject EmployeeTaskService EmployeeTaskService
    
    <DxTreeList Data="TreeListData"
                KeyFieldName="Id"
                ParentKeyFieldName="ParentId"
                ContextMenus="TreeListContextMenus.Header"
                CustomizeContextMenu="CustomizeContextMenu">
        <Columns>
            <DxTreeListSelectionColumn Width="80px" />
            <DxTreeListDataColumn FieldName="Name" Caption="Task" ShowInColumnChooser="false" />
            <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.Caption == "Task") {
                    args.Items.Remove(TreeListContextMenuDefaultItemNames.HideColumn);
                }
            }
        }
    }
    
    See Also