Edit this page

Mouse Support

RadRibbonView exposes several useful events, which can help you control the mouse interaction and get notified when mouse events occur. Moreover, by using the mouse you can perform some most common tasks, such as:

  • Execute actions - use your mouse to click any of the built-in or custom actions displayed by the RadRibbonView.

  • Minimize the ribbon bar - to toggle the minimization state of the RadRibbonView just double click on any of its tab headers.

Events

Here is a list of the mouse events exposed by the RadRibbonView object:

  • MouseWheel - occurs when the user rotates the mouse wheel. The type of the passed event arguments is MouseWheelEventArgs.

  • MouseMove - occurs when the coordinate position of the mouse changes. The type of the passed event arguments is MouseEventArgs.

  • MouseLeftButtonDown - occurs when the left mouse button is pressed. The type of the passed event arguments is MouseButtonEventArgs.

  • MouseLeftButtonUp - occurs when the left mouse button is released. The type of the passed event arguments is MouseButtonEventArgs.

  • MouseLeave - occurs when the mouse leaves the control. The type of the passed event arguments is MouseEventArgs.

  • MouseEnter - occurs when the mouse enters the control. The type of the passed event arguments is MouseEventArgs.

  • LostMouseCapture - occurs when the object loses mouse capture. The type of the passed event arguments is MouseEventArgs.

In the example below you can see how to attach to MouseWheel event from XAML.

XAML

<telerik:RadRibbonView x:Name="radRibbonView" MouseWheel="radRibbonView_MouseWheel" />

It is always a good practice to attach your event handlers in the XAML, whenever your application logic allows this.

And also from the code-behind:

C#

radRibbonView.MouseWheel+=new MouseWheelEventHandler(radRibbonView_MouseWheel);

VB.NET

radRibbonView.MouseWheel += New MouseWheelEventHandler(radRibbonView_MouseWheel)

The implementation of the event handler radRibbonView_MouseWheel() is located in the code-behind file (C# or VB.NET) and looks like this:

C#

private void radRibbonView_MouseWheel(object sender, MouseWheelEventArgs e)
{
    MessageBox.Show("The mouse wheel has changed: " + e.Delta);
}

VB.NET

Private Sub radRibbonView_MouseWheel(sender As Object, e As MouseWheelEventArgs)
    MessageBox.Show("The mouse wheel has changed: " & Convert.ToString(e.Delta))
End Sub

You can attach to the other mouse events in the same way.