WPF C# Tutorial

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Code Events" Height="300" Width="300">
  
    
  

//File:Window.xaml.cs
using System;
using System.Windows;
using System.Diagnostics;
namespace WpfApplication1
{
    public partial class Window1 : System.Windows.Window
    {
        public Window1()
        {
            InitializeComponent();
            myEllipse.MouseDown += MouseDownEllipse;
            myEllipse.PreviewMouseDown += PreviewMouseDownEllipse;
        }
        void PreviewMouseDownEllipse(object sender, RoutedEventArgs e)
        { Debug.WriteLine("PreviewMouseDownButton"); }
        void MouseDownEllipse(object sender, RoutedEventArgs e)
        { Debug.WriteLine("MouseDownButton"); }        
    }
}