MouseGesture Class
.NET Framework 3.0
Defines a mouse input gesture that can be used to invoke a command.
Namespace: System.Windows.Input
Assembly: PresentationCore (in presentationcore.dll)
XML Namespace: http://schemas.microsoft.com/winfx/2006/xaml/presentation
Assembly: PresentationCore (in presentationcore.dll)
XML Namespace: http://schemas.microsoft.com/winfx/2006/xaml/presentation
'Declaration <TypeConverterAttribute(GetType(MouseGestureConverter))> _ Public Class MouseGesture Inherits InputGesture 'Usage Dim instance As MouseGesture
/** @attribute TypeConverterAttribute(System.Windows.Input.MouseGestureConverter) */ public class MouseGesture extends InputGesture
TypeConverterAttribute(System.Windows.Input.MouseGestureConverter) public class MouseGesture extends InputGesture
<MouseGesture .../>
<object property="mouseAction"/> - or - <object property="oneOrMoreModifierKeys"/> - or - <object property="mouseAction+oneOrMoreModifierKeys"/>
mouseAction MouseAction A single mouse action. For more information, see the MouseAction property. oneOrMoreModifierKeys One or more modifier keys, defined by the ModifierKeys enumeration, delimited with a "+" character. For more information, see the Modifiers property.
Unlike a KeyGesture, a MouseAction does not have to be paired with ModifierKeys to be a valid MouseGesture.
A MouseGesture can be bound to an ICommand through a MouseBinding so that the command is invoked when the MouseGesture occurs.
The following example shows to create a MouseGesture and associate it with a RoutedCommand through a MouseBinding. When the mouse wheel is clicked while the Control key is pressed, the Open is invoked.
<MouseBinding Gesture="Control+WheelClick" Command="ApplicationCommands.Open" />
MouseGesture OpenCmdMouseGesture = new MouseGesture(); OpenCmdMouseGesture.MouseAction = MouseAction.WheelClick; OpenCmdMouseGesture.Modifiers = ModifierKeys.Control; MouseBinding OpenCmdMouseBinding = new MouseBinding(); OpenCmdMouseBinding.Gesture = OpenCmdMouseGesture; OpenCmdMouseBinding.Command = ApplicationCommands.Open; this.InputBindings.Add(OpenCmdMouseBinding);
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.Community Additions
ADD
Show: