6. Event Bubbling
• Events Bubble up the XAML Tree
– They do not bubble into the HTML tree
• Origin indicated by OriginalSource
• Set Handled=true to halt bubbling
• No tunneling
– No Preview events
• Intrinsic events only
7. Mouse Capture
• Mouse can move out of element
– What if we still want events
• Capture mouse events
• Should release capture when done
– May get early LostMouseCapture
8. Right Mouse Button
• New in Silverlight 4
• No built-in custom context menu
– April 2010 Silverlight toolkit provides one: http://silverlight.codeplex.com/
Silverlight
10. Touch
• Touch input as mouse substitute
• Touch aware code
– Can handle multi-touch
– Specialized touch-based interaction
• Touch.FrameReported event
– GetTouchPoints
– GetPrimaryTouchPoint
– SuspendMousePromotionUntilTouchUp
• Gestures on Windows Phone 7 only
11. Keyboard
• KeyUp and KeyDown events
– KeyEventArgs.Key
– KeyEventArgs.PlatformKeyCode
• Focus
– Plug-in model makes this slightly messy
– Only Control-derived classes can receive focus
12. Controls
• Textual input with TextBox
– Globalized
– Accessible
– Data bindable
• Button
– Accessible
There are several ways for a user to interact with your application. The most obvious way is with the mouse. Silverlight offers event to track mouse and button movement as well as wheel activity.
There is also the keyboard of course.
Silverlight also supports touch screen events
Mouse events happen when the mouse is over the object and not its bounding box.
You only get mouse events in the area that has been painted with a brush.
Use the IsHitTestVisible property to ignore events.