<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="WpfApplication1.EventSetterDemo" Title="EventSetter Demo"> <Window.Resources> <Style TargetType="{x:Type Button}"> <EventSetter Event="Click" Handler="ButtonOnClick" /> </Style> </Window.Resources> <StackPanel> <Button>Button 1</Button> <Button>Button 2</Button> <Button>Button 3</Button> </StackPanel> </Window> //File:Window.xaml.cs using System; using System.Windows; using System.Windows.Controls; using System.Windows.Input; using System.Windows.Media; namespace WpfApplication1 { public partial class EventSetterDemo : Window { public EventSetterDemo() { InitializeComponent(); } void ButtonOnClick(object sender, RoutedEventArgs args) { Button btn = args.Source as Button; Console.WriteLine(btn.Content); } } }