WPF VB.Net

  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  x:Class="WpfApplication1.RoutedEventHandle" Name="dpanel" Button.Click="HandleClick">
  
      
        
        
        
      
  

  Item 1
  Item 2

//File:Window.xaml.vb
Imports System
Imports System.Text
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Documents
Namespace WpfApplication1
  Public Partial Class RoutedEventHandle
    Inherits StackPanel
    Private Sub HandleClick(sender As Object, args As RoutedEventArgs)
      Dim fe As FrameworkElement = DirectCast(sender, FrameworkElement)
      Console.WriteLine("Event handled by element named ")
      Console.WriteLine(fe.Name)
      Dim fe2 As FrameworkElement = DirectCast(args.Source, FrameworkElement)
      Console.WriteLine("Event originated from source element of type ")
      Console.WriteLine(args.Source.[GetType]().ToString())
      Console.WriteLine(" with Name ")
      Console.WriteLine(fe2.Name)
      Console.WriteLine(args.RoutedEvent.RoutingStrategy)
    End Sub
  End Class
End Namespace