XAML -------------------------------------------------------- CSS ------------------------------------------------------------ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace wpf_kurs_v { /// /// Interaction logic for MainWindow.xaml /// public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } private void CommonClickHandler(object sender, RoutedEventArgs e) { FrameworkElement feSource = e.Source as FrameworkElement; switch (feSource.Name) { case "YesButton": MessageBox.Show( "Yes, yes , yes !" ); break; case "NoButton": MessageBox.Show( "Oh no !" ); break; case "CancelButton": MessageBox.Show( "But why ?? o_O" ); break; } e.Handled = true; } } } ===================================================================================== nazwa Routed Events using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace RoutedEvents { /// /// Interaction logic for MainWindow.xaml /// public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } private void OnMouseDown(object sender, MouseButtonEventArgs e) { string message = "Sender: " + sender.ToString() + "\r\n" + "Source: " + e.Source + "\r\n" + "OriginalSource: " + e.OriginalSource + "\r\n"; listBox.Items.Add(message); } private void OnMouseUp(object sender, MouseButtonEventArgs e) { listBox.Items.Clear(); } } } ============================================================ przyklad na buble