Understanding event bubbling


show more Understanding event bubbling provides you with in-depth training on Developer. Taught by Walt Ritscher as part of the Silverlight 5 Essential Training show less
please wait ...

Understanding event bubbling

You can define a routed EventHandler in any element in the Element tree. When an event fires, it starts on the original element and traverses the element tree looking for EventHandlers. Each handler encountered on the way to the root element is called in sequence. I am going to demonstrate that by using a project called EventBubbling. I am going to start by using this file, WatchTheBubbling. I will double-click on this file and show you my UI. I have a dice prototype here that is composed of a number of children elements.

For instance, there is a Rectangle, the name of the rectangle is called diceBody. That is a child of a canvas and the canvas is called diceCanvas. There are also some ellipses and each one of these ellipses is called pip 1, pip 2 and so on. So the ellipse is a child of the canvas and the rectangle is the child of the canvas. Let's switch to the code view. Over here I wired up the MouseLeftButtonDown EventHandler to the root element which is my user control and then ...

Understanding event bubbling
Video duration: 4m 39s 8h 52m Beginner

Viewers:

Understanding event bubbling provides you with in-depth training on Developer. Taught by Walt Ritscher as part of the Silverlight 5 Essential Training

Subject:
Developer
Software:
Silverlight Visual Studio
Author:
please wait ...