#654 – Mouse Events for Button Presses

When a user clicks on a mouse button, there are a series of preview events (tunneling) and actual events (bubbling) that travel up and down the logical tree.

For example, for a Label contained in a StackPanel, which is contained in a Window, the full sequence of events for a left mouse button click on the Label is:

  • PreviewMouseLeftButtonDown for Window
  • PreviewMouseDown for Window
  • PreviewMouseLeftButtonDown for StackPanel
  • PreviewMouseDown for StackPanel
  • PreviewMouseLeftButtonDown for Label
  • PreviewMouseDown for Label
  • MouseLeftButtonDown for Label
  • MouseDown for Label
  • MouseLeftButtonDown for StackPanel
  • MouseDown for StackPanel
  • MouseLeftButtonDown for Window
  • MouseDown for Window
  • PreviewMouseLeftButtonUp for Window
  • PreviewMouseUp for Window
  • PreviewMouseLeftButtonUp for StackPanel
  • PreviewMouseUp for StackPanel
  • PreviewMouseLeftButtonUp for Label
  • PreviewMouseUp for Label
  • MouseLeftButtonUp for Label
  • MouseUp for Label
  • MouseLeftButtonUp for Stackpanel
  • MouseUp for StackPanel
  • MouseLeftButtonUp for Window
  • MouseUp for Window

 

Advertisements

About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

2 Responses to #654 – Mouse Events for Button Presses

  1. Pingback: Dew Drop – September 25, 2012 (#1,408) | Alvin Ashcraft's Morning Dew

  2. Pingback: #661 – ButtonBase.Click Event vs. Mouse Click Events « 2,000 Things You Should Know About WPF

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: