Quick access menu event handling

5 posts, 1 answers
  1. Carsten
    Carsten avatar
    7 posts
    Member since:
    Sep 2008

    Posted 17 Sep 2008 Link to this post

    Hello,
    what is the correct event handler to get notice that the user has clicked "Show below the ribbon"/"Show above the ribbon" and "Minimize the ribbon"/"Maximize the ribbon"  of the quick access menu?

  2. Nick
    Admin
    Nick avatar
    767 posts

    Posted 18 Sep 2008 Link to this post

    Hello Carsten,

    Thank you for your questions.

    You can handle close, minimize and maximize events as the code below demonstrates:

    (this.radRibbonBar1.RibbonBarElement.Children[0].Children[1] as RadRibbonBarCaption).Minimize +=   
       new TitleBarSystemEventHandler(minimizeEventHandler); 

    As for the show below the ribbon/Show above the ribbon click events the code is a bit more complicated. You have to partition the task into two steps because items in the overflow button are created dynamically as you open it. First handle the click event of the overflow button and then handle the click event of the chosen item, in particular show below the ribbon/Show above the ribbon. Please note that the separator element is an item and is part of indexing. 

    private void Form1_Load(object sender, EventArgs e)  
    {  
      (this.radRibbonBar1.RibbonBarElement.Children[0].Children[0].Children[1].Children[1]  
                   as RadToolStripOverFlowButtonElement).Click += new EventHandler(Form1_Click);  
    }  
     
    void Form1_Click(object sender, EventArgs e)  
    {  
      RadToolStripOverFlowButtonElement button = (RadToolStripOverFlowButtonElement)sender;  
                button.Items[2].Click += new EventHandler(button_Click);  
    }  
     
    void button_Click(object sender, EventArgs e)  
    {  
                MessageBox.Show("hello");  

    Feel free to contact me if you have any further questions.

    Sincerely yours,

    Nick
    the Telerik team


    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Carsten
    Carsten avatar
    7 posts
    Member since:
    Sep 2008

    Posted 19 Sep 2008 Link to this post

    Hello Nick,

    thanks a lot for your answer. Unfortunately I had forgotten to tell you in my first post, that I program with VB.Net and I have some difficultys to "translate" your code-snippets into VB.Net. Probably you can give me an advice how to code it under VB.Net.

    Regards
    Carsten
  5. Answer
    Nick
    Admin
    Nick avatar
    767 posts

    Posted 19 Sep 2008 Link to this post

    Hi Carsten,

    The first code snippet in VB is:

    AddHandler (TryCast(Me.radRibbonBar1.RibbonBarElement.Children(0).Children(1), RadRibbonBarCaption)).Minimize, AddressOf minimizeEventHandler 

    And the second one is:

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)  
        AddHandler (TryCast(Me.radRibbonBar1.RibbonBarElement.Children(0).Children(0).Children(1).Children(1), RadToolStripOverFlowButtonElement)).Click, AddressOf Form1_Click  
    End Sub  
     
    Sub Form1_Click(ByVal sender As Object, ByVal e As EventArgs)  
        Dim button As RadToolStripOverFlowButtonElement = DirectCast(sender, RadToolStripOverFlowButtonElement)  
        AddHandler button.Items(2).Click, AddressOf button_Click  
    End Sub  
     
    Sub button_Click(ByVal sender As Object, ByVal e As EventArgs)  
        MessageBox.Show("hello")  
    End Sub 



    Best wishes,
    Nick
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  6. Carsten
    Carsten avatar
    7 posts
    Member since:
    Sep 2008

    Posted 22 Sep 2008 Link to this post

    Hello Nick,

    thanks a lot for your VB.Net codesnippets.

    Regards
    Carsten
Back to Top
UI for WinForms is Visual Studio 2017 Ready