Button PreviewMouseLeftButtonDown action and MouseLeftButtonDown action
<Window x:Class="TunnelingBubbling.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="TunnelingBubbling">
<Grid MouseLeftButtonDown="MouseDownGrid"
PreviewMouseLeftButtonDown="PreviewMouseDownGrid"
Width="300" Height="300">
<Button PreviewMouseLeftButtonDown="PreviewMouseDownButton"
MouseLeftButtonDown="MouseDownButton"
Click="MyClickEvent"
Name="btnGo">
<TextBox MouseLeftButtonDown="MouseLeftButtonDown"
PreviewMouseLeftButtonDown="PreviewMouseLeftButtonDown"
Width="200" Height="30" Name="textBox1">
</TextBox>
</Button>
</Grid>
</Window>
//File:Window.xaml.vb
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Data
Imports System.Windows.Documents
Imports System.Windows.Input
Imports System.Windows.Media
Imports System.Windows.Media.Imaging
Imports System.Windows.Shapes
Imports System.Diagnostics
Namespace TunnelingBubbling
Public Partial Class Window1
Inherits System.Windows.Window
Public Sub New()
InitializeComponent()
End Sub
Private Sub PreviewMouseDownGrid(sender As Object, e As RoutedEventArgs)
Debug.WriteLine("PreviewMouseDownGrid")
End Sub
Private Sub PreviewMouseDownButton(sender As Object, e As RoutedEventArgs)
Debug.WriteLine("PreviewMouseDownButton")
End Sub
Private Sub PreviewMouseLeftButtonDown(sender As Object, e As RoutedEventArgs)
Debug.WriteLine("PreviewMouseLeftButtonDown")
End Sub
Private Sub MyClickEvent(sender As Object, e As RoutedEventArgs)
Debug.WriteLine("MyClickEvent")
End Sub
Private Sub MouseLeftButtonDown(sender As Object, e As RoutedEventArgs)
Debug.WriteLine("MouseLeftButtonDown")
End Sub
Private Sub MouseDownButton(sender As Object, e As RoutedEventArgs)
Debug.WriteLine("MouseDownButton")
End Sub
Private Sub MouseDownGrid(sender As Object, e As RoutedEventArgs)
Debug.WriteLine("MouseDownGrid")
End Sub
End Class
End Namespace
Related examples in the same category