Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 156615
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T10:21:31+00:00 2026-05-11T10:21:31+00:00

In the MSDN article Understanding Routed Events and Commands In WPF , it states

  • 0

In the MSDN article Understanding Routed Events and Commands In WPF, it states

an event will bubble (propagate) up the visual tree from the source element until either it has been handled or it reaches the root element.

However, in this example, when you click the button, it doesn’t ‘bubble up the visual tree’ to get handled by the parent StackPanel event, i.e. clicking on the button fires no event.

Why not? What do they mean then by ‘bubbling up’ if not this?

XAML:

<Window x:Class='TestClickEvents456.Window1'     xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'     xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'     Title='Window1' Height='300' Width='300'>     <StackPanel x:Name='TheStackPanel'                 Background='Yellow'                 MouseDown='TheStackPanel_MouseDown'>         <Button x:Name='TheButton'                 Margin='10'                 Content='Click This'/>         <TextBlock x:Name='TheMessage'                    Text='Click the button or the yellow area'/>     </StackPanel> </Window> 

code-behind:

using System.Windows; using System.Windows.Input;  namespace TestClickEvents456 {     public partial class Window1 : Window     {         public Window1()         {             InitializeComponent();         }          private void TheStackPanel_MouseDown(object sender, MouseButtonEventArgs e)         {             TheMessage.Text = 'StackPanel was clicked.';         }      } } 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T10:21:32+00:00Added an answer on May 11, 2026 at 10:21 am

    The event bubbles up, until it gets handled…

    Since the Button does something with your mouse clicks, it absorbs your mouse event and turns it into a ClickEvent.

    If you use the PreviewMouseDown, you see that the StackPanel first receives the event before the button does.. Preview events use the Tunnel down approach..

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

From the MSDN article on STAThread: Indicates that the COM threading model for an
I've read the MSDN article about the layouts pass, that states: When a node
From the MSDN Article I read I should be using the StringBuilder rather than
Joe Duffy states in the MSDN article Using concurrency for scalability that the cost
The MSDN article on String.Normalize states simply: Returns a new string whose binary representation
This MSDN article states that any ProgID must meet several formal requirements, length restriction
The MSDN article here states, that the default implementation of GetHashCode() does not guarantee
This MSDN article says: HttpContext: Current is always null when accessed from within a
This MSDN article states that static classes should be declared as sealed and abstract.
There is this MSDN article about spcial characters in WPF/XAML : But those Things

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.