Features
Here you can find common information about the properties and methods of TouchManager.
Properties
TouchManager exposes the following public properties:
-
IsEnabled: A static property of type bool that indicates whether the TouchManager subscribes to any input events. The property has to be set at the startup of the application. Note that changing its value run-time after setting it to False is not supported.
Example 1: Setting IsEnabled
public partial class App : Application { protected override void OnStartup(StartupEventArgs e) { TouchManager.IsEnabled = false; base.OnStartup(e); } }
Public Partial Class App Inherits Application Protected Overrides Sub OnStartup(ByVal e As StartupEventArgs) TouchManager.IsEnabled = False MyBase.OnStartup(e) End Sub End Class
The property can be set also before the InitializeComponent call of the main window.
Disabling the TouchManager will decrease the memory footprint of the application.
IsTouchEnabled: A static property of type bool that indicates whether the TouchManager will respond to any touch events. It can be used to enable or disable the touch interactions with the elements that use the TouchManager. The default value is true.
TouchMode: An attached property of type Telerik.Windows.Input.Touch.TouchMode enumeration that gets or sets the touch mode of the control. You can read more about the property in the Touch Modes help article.
-
ScrollViewerSwipeMode: An attached property of type Telerik.Windows.Input.Touch.ScrollViewerSwipeMode enumeration that gets or sets the mode that defines the additional swipe logic for a ScrollViewer or an element in a ScrollViewer. The enumeration contains the following modes.
- None (default): The element does not have additional logic for swiping.
- Self: If an unhandled swipe gesture occurs, the ScrollViewer will get panned. > The element on which this value is set should be a ScrollViewer. Otherwise, an exception will be thrown.
- Parent: If an unhandled swipe gesture occurs for this element, the first ScrollViewer parent will get panned.
Example 2: Setting ScrollViewerSwipeMode in XAML
<ListBox x:Name="element" telerik:TouchManager.ScrollViewerSwipeMode="Parent">
Example 3: Setting ScrollViewerSwipeMode in code
TouchManager.SetScrollViewerSwipeMode(this.element, ScrollViewerSwipeMode.Parent);
TouchManager.SetScrollViewerSwipeMode(Me.element, ScrollViewerSwipeMode.Parent);
ShouldSuspendMousePromotion: An attached property of type bool that indicates whether mouse events should be suspended during touch input. The default value is false.
DragStartDistance: A static property of type double that gets or sets the minimum distance a touch point has to move before the action is considered a drag. The distance is measured in pixels. The default value is 5.
PinchStartDistance: A static property of type double that gets or sets the minimum distance a touch point has to move before the action is considered a pinch. The distance is measured in pixels. The default value is 5.
SwipeStartDistance: A static property of type double that gets or sets the minimum distance a touch point has to move before the action is considered a swipe. The distance is measured in pixels. The default value is 5.
SwipeInertiaDuration: A static property of type int that gets or sets the duration of the swipe inertia. The duration is measured in milliseconds. The default value is 1000.
TapTime: A static property of type int that gets or sets the time that can elapse between a touch down and a touch up for the action to be considered a tap. The time is measured in milliseconds. The default value is 800.
TapVicinity: A static property of type double that gets or sets the maximum distance a touch point can move for the action to be considered a tab. The distance is measured in pixels. The default value is 5.
When Tap and Swipe gestures are used, the TapVicinity property needs to be less than SwipeStartDistance, otherwise it will not have an effect.
MultiTapTime: A static property of type int that gets or sets the time that can elapse between two successive tap actions for the TouchManager to consider them as multiple taps. The time is measured in milliseconds. The default value is 500.
MultiTapVicinity: A static property of type int that gets or sets the distance between two successive tap actions for the TouchManager to consider them as multiple taps. The distance is measured in pixels. The default value is 10.
-
DragStartTrigger: An attached property of type Telerik.Windows.Input.Touch.TouchDragStartTrigger enumeration that gets or sets the touch action that triggers the drag operation. The enumeration contains the following triggers.
- TapHoldAndMove: The drag operation will be triggered during a TouchMove event after a TapAndHold.
- TouchMove: The drag operation will be triggered during a TouchMove, regardless of whether a TapAndHold event has occured or not.
- TapAndHold (default): The drag operation will be triggered during a TapAndHold event.
Example 4: Setting DragStartTrigger in XAML
<Border x:Name="element" telerik:TouchManager.DragStartTrigger="TapHoldAndMove">
Example 5: Setting DragStartTrigger in code
TouchManager.SetDragStartTrigger(this.element, TouchDragStartTrigger.TapHoldAndMove);
TouchManager.SetDragStartTrigger(Me.element, TouchDragStartTrigger.TapHoldAndMove);
The IsTouchHitTestVisibility property is obsolete and replaced by the TouchMode property.
Methods
TouchManager exposes the following methods:
CeaseGestures: This method ceases the execution of any active gestures for elements within the root UIElement.
CaptureTouch: This method attempts to capture the touch device.
ReleaseTouchCapture: This method releases the captured touch device.
GetCaptured: This method gets the UIElement that has captured the touch device.
Touch Indicator
TouchManager visualizes an animated touch indicator when there is a tap and hold gesture performed on the screen.
The indicator supports theming and it will have a different appearance in the different themes.