RadContextMenu to RadButtonElement on RibbonBar

2 posts, 0 answers
  1. Kamila
    Kamila avatar
    3 posts
    Member since:
    Mar 2012

    Posted 05 Jun 2012 Link to this post

    Helou

    How to add RadContextMenu to RadButtonElement on RibbonBar.

    Fore some buttons on RibbonBar i have data in db. 
    I don't know how many items there are so I can't define the number of RadMenuItems.
    I have no problem with read it from db.

    You write
    "Select the RadContextMenu component and click its Smart-Tag. From the Action Menu click on the Add ContextMenuManager option. This will create a RadContextMenuManager instance and will add a RadContextMenu property to all the controls on our form.     "
    Its not true. There no RadContextMenu property  for controls at ribbon bar (or i can't fint it).

    For some controls i wpuld like to do context menu like this

      Pos1
         Item1
         Item2
         Item3
     Pos2
        Item1
     Pos3
       Item1
       Item2


    Thanks for help
    Kamila
  2. Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 06 Jun 2012 Link to this post

    Hello Kamila,

    Thank you for this question.

    Please note that a RadContextMenu property will appear on all controls, but not at the elements accommodated by these controls. To make thing more clear, in this particular scenario RadRibbonBar is a control, while RadButtonElement is just an element inside it.

    In order to be able to show a RadContextMenu at a RadButtonElement, handle the MouseDown event of this element, check of the mouse button if the right one and call the Show method of the RadContextMenu component:

    void radButtonElement1_MouseDown(object sender, MouseEventArgs e)
    {
        if (e.Button == System.Windows.Forms.MouseButtons.Right)
        {
            this.radContextMenu1.Show(Cursor.Position);
        }
    }

    I hope this helps.

    Kind regards,
    Nikolay
    the Telerik team
    RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top