Hi,
"NodeMouseClick" in Ultra Tree View for getting the Context menu strip.
M.
How can i position my Context menu generated through short cut keys(SHIFT +F10) at the node itself.The context menu is generated at the right position when i do a right click but when i press the short cut keys to generate this,the context menu appears far away from the node.I am facing this Problem both in Ultra tree and in Ultra grid.
Thanks.
Thanks for the reply.The solutions works for me.Could you please explain what exactly is happenning in this? I didnt get the meaning of UIElement and NodeSelectableAreaUIElement.
/// <summary>/// Handles the UltraTree's MouseDown event./// </summary>private void UltraTree_MouseDown( object sender, MouseEventArgs e ){ if ( e.Button == MouseButtons.Right ) { UltraTree tree = sender as UltraTree; UIElement controlElement = tree != null ? tree.UIElement : null; UIElement elementAtPoint = controlElement != null ? controlElement.ElementFromPoint( e.Location ) : null; NodeSelectableAreaUIElement nodeElement = null;
while ( elementAtPoint != null ) { nodeElement = elementAtPoint as NodeSelectableAreaUIElement; if ( nodeElement != null ) break;
elementAtPoint = elementAtPoint.Parent; }
if ( nodeElement != null ) { // If you get in here, the right mouse button // was pressed on the node's selectable area, which does // not include the expansion indicator. } }}
I am using Mouse down event for displaying the context menu strip on a tree node.I dont want the Context menu to appear on the + node.how can i avoid that?
Thanks,Mansi
My setup is using a standard .Net context menu for the tree, not the form. Not sure why yours isn't working.
Have you checked some other settings, such as:
' Make the main tree fully editable by defaultMe.MyTree.ColumnSettings.AllowCellEdit = AllowCellEdit.FullMe.MyTree.Override.CellClickAction = CellClickAction.SelectNodeOnly
' Set Up Drag and DropMe.MyTree.Override.SelectionType = SelectType.SingleAutoDrag
I had to try different settings to get the behavior I wanted.
JC