WPF C# Tutorial

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="WPF" Height="150" Width="300">
                     MouseDown="UniformGrid_MouseDown">
        
                       HorizontalContentAlignment="Center" 
               MaxHeight="25" MaxWidth="100"/>
                       HorizontalAlignment="Center" VerticalAlignment="Center"
               Name="TextBlock"/>
        
                            Height="25" Width="100" Name="Rectangle"/>
                               IsHitTestVisible="False"/>            
        
    

//File:Window.xaml.cs
using System.Windows;
using System.Windows.Input;
namespace WpfApplication1
{
    public partial class Window1 : Window
    {
        public Window1()
        {
            InitializeComponent();
        }
        // Handles the MouseDown event on the Canvas.
        private void Canvas_MouseDown(object sender, MouseButtonEventArgs e)
        {
            FrameworkElement fe = e.OriginalSource as FrameworkElement;
            MessageBox.Show("Mouse Down on " + fe.Name, "Canvas");
        }
        // Handles the Click event on the UniformGrid.
        private void UniformGrid_Click(object sender, RoutedEventArgs e)
        {
            FrameworkElement fe = e.OriginalSource as FrameworkElement;
            MessageBox.Show("Mouse Click on " + fe.Name, "Uniform Grid");
        }
        // Handles the MouseDown event on the UniformGrid.
        private void UniformGrid_MouseDown(object sender, MouseButtonEventArgs e)
        {
            FrameworkElement fe = e.OriginalSource as FrameworkElement;
            MessageBox.Show("Mouse Down on " + fe.Name, "Uniform Grid");
        }
    }
}