Skip to main content
All docs
V25.1
  • DevExpress v25.1 Update — Your Feedback Matters

    Our What's New in v25.1 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

    Take the survey Not interested

    TreeViewControl.NodeMenuCustomizations Property

    Allows you to add menu items to a node’s context menu.

    Namespace: DevExpress.Xpf.Grid

    Assembly: DevExpress.Xpf.Grid.v25.1.dll

    NuGet Package: DevExpress.Wpf.Grid.Core

    #Declaration

    [Browsable(false)]
    public BarManagerActionCollection NodeMenuCustomizations { get; }

    #Property Value

    Type Description
    BarManagerActionCollection

    A collection of bar actions that allows you to customize the node’s context menu.

    #Remarks

    The following code sample creates a context menu that allows users to remove nodes and copy a node’s data:

    <Window
            xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid" 
            xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars"
            ... >
      <dxg:TreeViewControl x:Name="treeview" 
                           ... >
          <dxg:TreeViewControl.NodeMenuCustomizations>
              <dxb:BarButtonItem Name="deleteNode" Content="Delete Node" ItemClick="deleteNode_ItemClick"/>
              <dxb:BarButtonItem Name="copyNodeData" Content="Copy Node Data" ItemClick="copyNodeData_ItemClick"/>
          </dxg:TreeViewControl.NodeMenuCustomizations>
      </dxg:TreeViewControl>
    </Window>
    
    void deleteNode_ItemClick(object sender, DevExpress.Xpf.Bars.ItemClickEventArgs e) {
        treeview.DeleteNode(treeview.CurrentNode);
    }
    
    void copyNodeData_ItemClick(object sender, DevExpress.Xpf.Bars.ItemClickEventArgs e) {
        treeview.CopySelectedItemsToClipboard();
    }
    
    See Also