Bubble routed events, and write an event handler for a routed event
//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