//File:Window.xaml.vb Imports System Imports System.Windows Imports System.Windows.Controls Namespace WpfApplication1 Public Partial Class Window1 Inherits Window Public Sub New() InitializeComponent() End Sub Private Sub SharedButtonClickHandler(sender As Object, e As RoutedEventArgs) Dim source As Button = TryCast(e.OriginalSource, Button) If source IsNot Nothing Then Dim message As String = [String].Format("{0} was pressed.", source.Content) MessageBox.Show(message, Title) End If End Sub End Class End Namespace