//File:Window.xaml.vb Imports System.Windows Imports System.Windows.Input Namespace WpfApplication1 Public Partial Class Window1 Inherits Window Public Sub New() InitializeComponent() End Sub ' Handles the MouseDown event on the Canvas. Private Sub Canvas_MouseDown(sender As Object, e As MouseButtonEventArgs) Dim fe As FrameworkElement = TryCast(e.OriginalSource, FrameworkElement) MessageBox.Show("Mouse Down on " & fe.Name, "Canvas") End Sub ' Handles the Click event on the UniformGrid. Private Sub UniformGrid_Click(sender As Object, e As RoutedEventArgs) Dim fe As FrameworkElement = TryCast(e.OriginalSource, FrameworkElement) MessageBox.Show("Mouse Click on " & fe.Name, "Uniform Grid") End Sub ' Handles the MouseDown event on the UniformGrid. Private Sub UniformGrid_MouseDown(sender As Object, e As MouseButtonEventArgs) Dim fe As FrameworkElement = TryCast(e.OriginalSource, FrameworkElement) MessageBox.Show("Mouse Down on " & fe.Name, "Uniform Grid") End Sub End Class End Namespace