ContextMenu in RibbonNumericBox Class

Posted by: cnoelle on 14 July 2022, 1:33 am EST

  • Posted 14 July 2022, 1:33 am EST

    In the help there is a
    public ContextMenuStrip ContextMenuStrip {get; set;}

    but I cannot set.
    I need some mouse interaction to translate the numeric to char by pop up an ascii table or similar.

    Regards
  • Replied 15 July 2022, 4:13 am EST

    Hi,

    The ContextMenuStrip property of the RibbonNumericBox can be used to assign a context menu to the numeric box of the RibbonNumericBox. Please refer to the sample and the GIF attached.

    Regards
    Avnish

    Ribbon_ContextMenuCheck.zip
  • Replied 27 July 2022, 12:10 am EST

    Thanks, helped me...
    Regards

    Chris
  • Replied 3 August 2022, 11:51 pm EST

    If I have two ore more RibbonNumericBoxes, how can I cast the underlying box to the common opening event of the contextmenustrip?
    e.g.
    ribbonNumericBox1,ContextMenuStrip=_contextMenuStrip;
    ribbonNumericBox2,ContextMenuStrip=_contextMenuStrip;
    ribbonNumericBox3,ContextMenuStrip=_contextMenuStrip;

    private void Item_Opening(object sender, CancelEventArgs e)
    {
    sourceControl = _contextMenuStrip.SourceControl;

    HowTo further cast into ribbonNumericBox and change its value?
    }
  • Replied 4 August 2022, 3:17 pm EST

    Hi,

    The RibbonNumericBox uses a TextBox internally and the ContextMenuStrip.SourceControl returns that TextBox.
    There is no direct property or method to get the Parent RibbonNumericBox but as a workaround, you can use the Location of the TextBox returned by the ContextMenuStrip.SourceControl and then use that location with the Ribbon.GetItemAt method to get the RibbonItem at that location.
    Please refer to the sample attached.

    Regards
    Avnish

    Ribbon_ContextMenu_mod.zip
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels