ContextMenu in RibbonNumericBox Class

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

  • Posted 14 July 2022, 10: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

  • Posted 15 July 2022, 1:13 pm 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[img]https://gccontent.blob.core.windows.net/forum-uploads/file-faba0d6f-34a8-4fca-9766-7cf672c0e873.gif[/img]

  • Posted 27 July 2022, 9:10 am EST

    Thanks, helped me…

    Regards

    Chris

  • Posted 4 August 2022, 8:51 am 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;
    
    	[b]HowTo further cast into ribbonNumericBox and change its value?[/b]
            }
    
    
  • Posted 5 August 2022, 12:17 am 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