Occurs when a user clicks the mouse button two or more times.
Assembly: PresentationFramework (in PresentationFramework.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
Although this routed event seems to follow a tunneling route through an element tree, it actually is a direct routed event that is raised along the element tree by each UIElement. If you set the Handled property to true in a event handler, subsequent events along the route will occur with Handled set to false, but the MouseDoubleClick event will occur with Handled set to true. This is a higher-level event for control consumers who want to be notified when the user double-clicks the control and to handle the event in an application.
Control authors who want to handle mouse double clicks should use the PreviewMouseLeftButtonDown event when ClickCount is equal to two. This will cause the state of Handled to propagate appropriately in the case where another element in the element tree handles the event.
The Control class defines the and MouseDoubleClick events, but not corresponding single-click events. To see if the user has clicked the control once, handle the MouseDown event (or one of its counterparts) and check whether the ClickCount property value is 1.
The following example shows how to attach an event handler the event.
The following example shows the event handler of the event.
Private Sub ChangeForeground(ByVal Sender As Object, ByVal e As System.Windows.Input.MouseButtonEventArgs) If (btn1.Foreground Is Brushes.Green) Then btn1.Foreground = Brushes.Black btn1.Content = "Foreground" Else btn1.Foreground = Brushes.Green btn1.Content = "Control foreground(text) changes from black to green." End If End Sub
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)