This is a migrated thread and some comments may be shown as answers.

Quick access menu event handling

4 Answers 56 Views
RibbonBar
This is a migrated thread and some comments may be shown as answers.
Carsten
Top achievements
Rank 1
Carsten asked on 17 Sep 2008, 03:44 PM
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?

4 Answers, 1 is accepted

Sort by
0
Nick
Telerik team
answered on 18 Sep 2008, 03:24 PM
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.
0
Carsten
Top achievements
Rank 1
answered on 19 Sep 2008, 07:25 AM
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
0
Accepted
Nick
Telerik team
answered on 19 Sep 2008, 04:16 PM
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.
0
Carsten
Top achievements
Rank 1
answered on 22 Sep 2008, 11:11 AM
Hello Nick,

thanks a lot for your VB.Net codesnippets.

Regards
Carsten
Tags
RibbonBar
Asked by
Carsten
Top achievements
Rank 1
Answers by
Nick
Telerik team
Carsten
Top achievements
Rank 1
Share this question
or