Bubble routed events, and write an event handler for a routed event
//File:Window.xaml.cs
using System;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
namespace WpfApplication1
{
public partial class RoutedEventHandle : StackPanel
{
void HandleClick(object sender, RoutedEventArgs args)
{
FrameworkElement fe = (FrameworkElement)sender;
Console.WriteLine("Event handled by element named ");
Console.WriteLine(fe.Name);
FrameworkElement fe2 = (FrameworkElement)args.Source;
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);
}
}
}