12

manipulation events. ManipulationStarting and ManipulationStarted. ManipulationDelta. ManipulationCompleted combine info from multiple events IsManipulationEnabled=true

Embed Size (px)

Citation preview

Page 1: manipulation events. ManipulationStarting and ManipulationStarted. ManipulationDelta. ManipulationCompleted combine info from multiple events IsManipulationEnabled=true
Page 2: manipulation events. ManipulationStarting and ManipulationStarted. ManipulationDelta. ManipulationCompleted combine info from multiple events IsManipulationEnabled=true
Page 3: manipulation events. ManipulationStarting and ManipulationStarted. ManipulationDelta. ManipulationCompleted combine info from multiple events IsManipulationEnabled=true

manipulation events

•. ManipulationStarting and ManipulationStarted . ManipulationDelta. ManipulationCompleted

•combine info from multiple events

• IsManipulationEnabled=true on this or a parent and basic events not handled

•manipulation starting and started at first finger touchdown, delta at touchmove, and completed after touchup for all fingers

•starting and started allow to customize or cancel or disallow some manipulations

•ManipulationDelta class has Translation, Scale, Rotation, Expansion (like Scale but dev ind px instead of scale factor)

•ManipulationDeltaEventArgs has DeltaManipulation and CumulativeManipulation

•e.g. move rotate zoom a photo

Page 4: manipulation events. ManipulationStarting and ManipulationStarted. ManipulationDelta. ManipulationCompleted combine info from multiple events IsManipulationEnabled=true
Page 5: manipulation events. ManipulationStarting and ManipulationStarted. ManipulationDelta. ManipulationCompleted combine info from multiple events IsManipulationEnabled=true
Page 6: manipulation events. ManipulationStarting and ManipulationStarted. ManipulationDelta. ManipulationCompleted combine info from multiple events IsManipulationEnabled=true

•manipulations always done relative to a manipulation container...

•by def. element with ismanipulationenabled=true

•or handle ManipulationStarting event and set ManipulationStartingEventArgs. ManipulationContainer

•Inertia ?

•ManipulationInertiaStarting event when all fingers loose contact even before completed event

•by default manipulationcompleted thrown right away

•but you can set ManipulationInertiaStartingEventArgs. TranslationBehavior, .RotationBehavior, and/or .ExpansionBehavior

•then deltas thrown and then completed until inertia

Page 7: manipulation events. ManipulationStarting and ManipulationStarted. ManipulationDelta. ManipulationCompleted combine info from multiple events IsManipulationEnabled=true

• . TranslationBehavior—DesiredDisplacement, DesiredDeceleration, and InitialVelocity

• . RotationBehavior—DesiredRotation, DesiredDeceleration, and InitialVelocity

• . ExpansionBehavior—DesiredExpansion, DesiredDeceleration, InitialRadius, and InitialVelocity

•Typically only set DesiredDeceleration or the behavior-specific DesiredDisplacement, DesiredRotation, or DesiredExpansion

•The latter properties are useful for ensuring that the element doesn’t go too far. By default, InitialVelocity and InitialRadius are initialized with the current values. You can get the various velocities by checking ManipulationInertiaStartingEventArgs.InitialVelocities, which has LinearVelocity, AngularVelocity, and ExpansionVelocity

Page 8: manipulation events. ManipulationStarting and ManipulationStarted. ManipulationDelta. ManipulationCompleted combine info from multiple events IsManipulationEnabled=true
Page 9: manipulation events. ManipulationStarting and ManipulationStarted. ManipulationDelta. ManipulationCompleted combine info from multiple events IsManipulationEnabled=true

•be boundary aware

•ManipulationBoundaryFeedback event

•Inside a ManipulationDelta event handler, you can call the ReportBoundaryFeedback method on the passed-in ManipulationDeltaEventArgs instance to make the window bounce... similar to iphone bounce list behavior

•e.g. spin prize wheel

Page 10: manipulation events. ManipulationStarting and ManipulationStarted. ManipulationDelta. ManipulationCompleted combine info from multiple events IsManipulationEnabled=true
Page 11: manipulation events. ManipulationStarting and ManipulationStarted. ManipulationDelta. ManipulationCompleted combine info from multiple events IsManipulationEnabled=true
Page 12: manipulation events. ManipulationStarting and ManipulationStarted. ManipulationDelta. ManipulationCompleted combine info from multiple events IsManipulationEnabled=true

•You can take advantage of panning support built into ScrollViewer by setting its PanningMode property to HorizontalOnly, VerticalOnly, HorizontalFirst, VerticalFirst, or Both

•You can download the Surface Toolkit for Windows Touch to get numerous slick Microsoft Surface WPF controls that are optimized for multi-touch. This includes “surface versions” of most common controls (such as SurfaceButton and SurfaceCheckBox) and brand-new controls (such as ScatterView and LibraryStack).