Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
350
Context Menu
posted

Can someone walk me through adding a context menu to UltraTreeView Node

 

I already have a treeview set up

 

 

private

 

 

void ultraTree_MouseUp(object sender, MouseEventArgs e)

{

 

 

ContextMenu contextMenu = new ContextMenu();

 

 

if (e.Button == MouseButtons.Right)

{

   This is where I want to add the context meun when I right click, can someone assist me, this will be my first time adding a context menu dynamically

}

}

Parents
No Data
Reply
  • 69832
    Offline posted

    First assign a System.Windows.Forms.ContextMenu component to the control's ContextMenu property. Typically you then handle MouseDown for the right button, use GetNodeFromPoint to get a context on the node that was right-clicked, clear the ContextMenu's MenuItems collection and repopulate it as appropriate for that node.

Children