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
}
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.
Hi ,
Thanks for responding.
I was trying to add the contextMenu dynamically. I dont see a ContextMenu Property, But I do see a ContextMenuStrip Property.
Question So in order to add a context menu to dynamically , do I still have to drop the ContextMenu control on the form.
Also is there an Ultra ContextMenu control ?
I'm not sure why you can't see the ContextMenu property, unless you're using VB and they hide it or something.
No, you don't have to drop the component on the form to create either a ContextMenu or a ContextMenuStrip. Just declare a new instance using the public constructor.
We have a ContentMenu-derived component in the Infragistics.Win assembly (see Infragistics.Win.IGControls.IGContentMenu).