Step 1:


Design Windows Like Below

wpf8

♣    Select label control, open properties window, click events icon

♣    Select MouseDown event and double click

♣    Select Grid, open Properties window, generate MouseDown  event of grid

♣    Select MainWindow , open properties window, generate mousedown event of MainWindow

Step 2 :


Write the below code with in MainWindow.xaml.cs

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 WpfApplication2
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void label1_MouseDown(object sender, MouseButtonEventArgs e)
        {
            MessageBox.Show("This Message From Label Control");
        }
   
        private void Grid_MouseDown_1(object sender, MouseButtonEventArgs e)
        {
            MessageBox.Show("This Message From Grid Container Control");
        }

        private void Window_MouseDown(object sender, MouseButtonEventArgs e)
        {
            MessageBox.Show("This Message From MainWindow Container Control");
        }
    }
}

Output :


wpf9

Conclusion :


♣    In this above example when the user click on label first label mouse down event is firing , Grid mouse down event is firing after that window mouse down event is firing, because mouse down events are bubbling events, these events control flow from child to parent