310 likes | 1.02k Views
APP-503T. Make great touch apps using XAML. Alnur Ismail Program Manager Microsoft Corporation. Agenda. Using built-in controls for great touch apps out of the box Customizing panning and zooming Using the touch API for advanced touch interaction Recap
E N D
APP-503T Make great touch apps using XAML Alnur Ismail Program Manager Microsoft Corporation
Agenda • Using built-in controls for great touch apps out of the box • Customizing panning and zooming • Using the touch API for advanced touch interaction • Recap You’ll leave with examples of how to • Quickly create touch enabled apps • Easily build advanced touch apps
demo Memories app
Controls that support the touch language • ListView/GridView • Swipe • Panning • Tap • FlipView • Panning ListView GridView FlipView
Controls that support the touch language • ScrollViewer • Panning • Optical zoom Optical zoom
Controls that support the touch language • JumpViewer • Semantic zoom
demo Custom panning and zooming using ScrollViewer
Enabling snap-points • <ScrollViewer • > • <StackPanel> • <Image Source="..."Height="533"Width="800"/> • <Image Source="..." Height="533" Width="800"/> • <Image Source="..." Height="533" Width="800"/> • ... • </StackPanel> • </ScrollViewer> VerticalSnapPointsType="Mandatory" VerticalSnapPointsAlignment="Near"
Enabling rails • <ScrollViewer • > • <TextBlock> • <!-- content --> • </TextBlock> • </ScrollViewer> HorizontalScrollMode="Rails" VerticalScrollMode="Rails"
Customizing zooming • //Setting min/max zoom factor • svContent.MinZoomFactor= .5f; • svContent.MaxZoomFactor = 8; • //Adding zoom snap-points • svContent.ZoomSnapPoints.Add(.5f); • svContent.ZoomSnapPoints.Add(1); • svContent.ZoomSnapPoints.Add(4); • svContent.ZoomSnapPoints.Add(8);
Gesture API • Properties • IsTapEnabled • IsHoldingEnabled • IsRightTapEnabled • Events • Tapped • Holding • RightTapped
Holding • privatevoid Holding(object sender, HoldingEventArgs e) • { • switch (e.HoldingState) • { • caseHoldingState.Started: • { • //perform action • }; • caseHoldingState.Canceled: • { • //undo action • }; • caseHoldingState.Completed: • { • //commit action • }; • } • }
demo Scale, translate & rotate content
Manipulation API • Properties • ManipulationModes • Events • ManipulationStarting • ManipulationStarted • ManipulationDelta • ManipulationCompleted • ManipulationInertiaStarting
demo Walkthrough rotating content
demo Painting
Pointer API • PointerDevice • Pointer • PointerPoint • Properties • PointerCaptures • Events • PointerPressed • PointerReleased • PointerMoved • PointerEntered • PointerExited • PointerCanceled • PointerCaptureLost • PointerWheelChanged
Painting with pointers • <Image • PointerPressed="PointerPressed"PointerReleased="PointerReleased"PointerMoved="PointerMoved" • /> PointerCanceled="PointerReleased"
Painting with pointers • privatevoidPointerMoved(object sender, PointerEventArgs e) • { • PointerPointpt = e.GetCurrentPoint(LayoutRoot); • ... • Linel = newLine() • { • ... • X2 = pt.Position.X, • Y2 = pt.Position.Y, • StrokeThickness= pt.Properties.Pressure, • }; • ... • }
Tips & tricks • Panning/zooming vs. translation/scaling • Independent thread vs. UI thread • ScrollViewer and manipulation APIs • Reactive/proactive events • Click vs. tap
How XAML makes Windows 8 touch easy • Quickly build touch apps using XAML controls which support common touch scenarios out-of-the-box • Easy to access powerful touch APIs that enable advanced scenarios in a familiar way • Code for touch, mouse and pen in a unified way • Low barrier to entry by using existing knowledge plus a few new concepts
Use Windows 8 touch capabilities + XAML to create great touch apps!And please provide feedback.
Related sessions • [APP-517T] Build polished collection and list apps using XAML • [APP-914T] The lifetime of XAML text: from input to display through printing
Further reading and documentation • Look at SDK samples for similar examples + code • Twitter: @alnurismail
thank you Feedback and questions http://forums.dev.windows.com Session feedbackhttp://bldw.in/SessionFeedback
© 2011 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.