MobileForms Toolkit Documentation

AdvancedTree.ContextMenu Property

Gets or sets the shortcut menu associated with the control.

new public System.Windows.Forms.ContextMenu ContextMenu {get; set;}

Property Value

A ContextMenu that represents the shortcut menu associated with the control.

Remarks

Behavior of the context menu is changed due to tooltips.

It is preferred to use Links instead of context menu as the navigation is faster. If you need to display context sensitive context menu, use GetCellAtPoint point method to determine where context menu was displayed (see sample bellow).

Example

[Visual Basic]
      
Private Sub ContextMenu1_Popup(ByVal sender As Object, _
    ByVal e As System.EventArgs) Handles ContextMenu1.Popup
    
    Dim pt As System.Drawing.Point
    Dim cea As Resco.Controls.AdvancedTree.CellEventArgs 
    
    pt = AdvancedTree1.PointToClient(AdvancedTree1.MousePosition)
    cea = AdvancedTree1.GetCellAtPoint(pt)
    
    If Not cea Is Nothing Then
        ContextMenu1.MenuItems(0).Text = cea.Node("Menu")
    End If
End Sub
            
    
[C#]
      
private void contextMenu1_Popup(object sender, System.EventArgs e)
{
    System.Drawing.Point                        pt;
    Resco.Controls.AdvancedTree.CellEventArgs    cea;     
    
    pt = advancedTree1.PointToClient(advancedTree1.MousePosition);
    cea = advancedTree1.GetCellAtPoint(pt);
    
    if (cea != null)
    {
        contextMenu1.MenuItems[0].Text = cea.Node["Menu"];
    }
}
            
    

See Also

AdvancedTree Class | Resco.Controls.AdvancedTree Namespace