• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content

Loading…

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

Like this presentation? Why not share!

Silverlight Input Handling

on

  • 1,533 views

 

Statistics

Views

Total Views
1,533
Views on SlideShare
1,533
Embed Views
0

Actions

Likes
0
Downloads
0
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • 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.

Silverlight Input Handling Silverlight Input Handling Presentation Transcript

  • Week 3 - Input Handling
    Jim LaVine
    jim.lavine @gmail.com
  • Agenda
    Mouse
    Touch
    Keyboard
    Event Bubbling
    Controls
    Introduction to Expression Blend
  • Code Behind
    <UserControl x:class="MyApp.Page">xmlns:="http://schemas.microsoft.com/client/2007/"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"<Grid x:Name="LayoutRoot" Background="White">    <TextBlock x:Name="messageTextBlock"/></Grid></UserControl>
    Public partial class Page : UserControl
    {
    public Page()
    {
    InitializeComponent();
    this.MouseLeftButtonDown += PageClick;
    }
    voidPageClick(object sender,MouseButtonEventArgs e)
    {
    PointmousePos = e.GetPosition.this;
    messageTextBlock.Text = “Click at: “ + mousePos;
    }
    }
  • Input Types
    Mouse
    Keyboard
    Touch
    Raw input only (no gestures) on non-mobile applications
    Windows phone has some gesture support
  • Mouse Input Events
    Mouse Button
    Movement
    MouseLeftButtonDown
    Wheel
    MouseMove
    MouseLeftButtonUp
    MouseWheel
    MouseEnter
    MouseRightButtonDown
    MouseLeave
    MouseRightButtonUp
    LostMouseCapture
    MouseWheelEventArgs
    MouseEventArgs
    MouseButtonEventArgs
  • 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
  • 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
  • Right Mouse Button
    New in Silverlight 4
    No built-in custom context menu
    April 2010 Silverlight toolkit provides one: http://silverlight.codeplex.com/
    Silverlight
  • Mouse Wheel
    Platform=specific oddities
    NPAPI Limitations
    No Mac Support
    HTML DOM may work
    No OOB
  • 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
  • Keyboard
    KeyUp and KeyDown events
    KeyEventArgs.Key
    KeyEventArgs.PlatformKeyCode
    Focus
    Plug-in model makes this slightly messy
    Only Control-derived classes can receive focus
  • Controls
    Textual input with TextBox
    Globalized
    Accessible
    Data bindable
    Button
    Accessible
  • Introduction to Expression Blend
    The development environment
    Resources & Styles
    Customize controls
    Applying animation
  • Reference Links
    http://channel9.msdn.com/shows/SilverlightTV/
    http://www.silverlight.net/learn/videos/expression/
    http://www.microsoft.com/design/toolbox/
    http://expression.microsoft.com/en-us/cc136522.aspx
  • Target Applications
    WPF & Silverlight
    Sketchflow
  • Summary
    Mouse
    Touch
    Keyboard
    Event Bubbling
    Controls
    Expression Blend