This documentation is archived and is not being maintained.

MouseWheelEventArgs Class

Provides data for various events that report changes to the mouse wheel delta value of a mouse device.

Namespace:  System.Windows.Input
Assembly:  PresentationCore (in PresentationCore.dll)

public class MouseWheelEventArgs : MouseEventArgs
You cannot directly create an instance of this class in XAML.

MouseWheelEventArgs is used with the following events:

The Delta property is positive if the mouse wheel is moved upward or forward (away from the user) or negative if the mouse wheel is moved downward or backward (toward the user).

This event is raised even for small mouse wheel movements. For some scenarios, it is appropriate to implement handlers that throttle small mouse wheel deltas by checking whether the delta exceeds a certain threshold. Otherwise, you might invoke your handler for cases where the mouse wheel delta was so small that any UI that is tied to the mouse wheel movement would not update. Exactly how you implement the threshold behavior in a handler and what that threshold should be is entirely implementation-specific.

The following example moves a TextBox up if the mouse wheel Delta is positive and moves the TextBox down if the mouse wheel Delta is negative. The TextBox is attached to a Canvas.

// Moves the TextBox named box when the mouse wheel is rotated. 
// The TextBox is on a Canvas named MainCanvas. 
private void MouseWheelHandler(object sender, MouseWheelEventArgs e)
    // If the mouse wheel delta is positive, move the box up. 
    if (e.Delta > 0)
        if (Canvas.GetTop(box) >= 1)
            Canvas.SetTop(box, Canvas.GetTop(box) - 1);

    // If the mouse wheel delta is negative, move the box down. 
    if (e.Delta < 0)
        if ((Canvas.GetTop(box) + box.Height) <= (MainCanvas.Height))
            Canvas.SetTop(box, Canvas.GetTop(box) + 1);



Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0