Represents an area that users can scroll through and that can contain other visible elements. Namespace: Microsoft.Surface.Presentation.Controls
Assembly: Microsoft.Surface.Presentation (in Microsoft.Surface.Presentation)
[TemplatePartAttribute(Name="PART_ElasticBorder", Type=typeof(Border))] public class SurfaceScrollViewer : ScrollViewer
/** @attribute TemplatePartAttribute(Name="PART_ElasticBorder", Type=System.Windows.Controls.Border) */ public class SurfaceScrollViewer extends ScrollViewer
SurfaceScrollViewer derives from the Microsoft Windows Presentation Foundation (WPF) ScrollViewer class, and adds Microsoft Surface-specific enhancements to the control.
Users can flick the content of a SurfaceScrollViewer control by touching the control, rapidly moving their finger a short distance, and then lifting their finger. When their finger is lifted, the content of the SurfaceScrollViewer control continues to move. The content then decelerates and comes to a stop. You can programmatically stop the movement caused by flicking by calling the StopFlick method.
You can manipulate the content of a SurfaceScrollViewer either by moving a scroll bar (like with the WPF SurfaceScrollViewer) or by direct touch interaction with the content itself. The ability to manipulate the content directly is called panning. By default, panning is enabled. You can disable it by setting the IsManipulationEnabled property to false.
When users are panning, the content moves in the same direction as the manipulating point of contact. When users use a scroll bar, the content moves in the opposite direction of the point of contact (standard control behavior).
SurfaceScrollViewer uses the SurfaceScrollInfo property to provide access to the ISurfaceScrollInfo interface. This interface extends the WPF IScrollInfo interface to provide extra methods for panning.
SurfaceScrollViewer supports elasticity, which is the ability to scroll beyond the boundaries (top, bottom, left, or right) of the content. As users scroll in this way, the ratio of touch movement to content movement increases. This behavior emulates the stretching of an elastic band; the content appears to be more difficult to move. When the touch is lifted, the content bounces back to its normal boundary. You can control the elasticity by setting the Elasticity property.
The following image shows a SurfaceScrollViewer control that is scrolled beyond the top of the content. This action occurs by touching the content itself and pulling the content down.
Dragging content down away from the SurfaceScrollViewer control
When the touch is lifted, the content bounces back to its normal boundary.
Releasing the dragged content in the SurfaceScrollViewer control
Flicking and elasticity work together. If content is moving because of inertia processing that occurs after the touch is lifted from the surface, the content can move beyond a content boundary during deceleration. When the content reaches its over-scroll limit (which the Elasticity property determines), it bounces and decelerates more rapidly until coming to rest on its normal boundary.
|If you use SurfaceScrollViewer as part of another control's template, you should set the PanningModeProperty attached property on the parent control to a value other than PanningMode.None; otherwise, panning will be disabled. For example, SurfaceListBox uses SurfaceScrollViewer in its template. To enable panning, SurfaceListBox sets the PanningModeProperty attached property.|
For more information, see SurfaceScrollViewer Control.
|Operating System (OS)||Windows 7|
|Software Developer Kit (SDK)||Surface 2.0 |
.NET Framework 4
|Developer environment||Visual Studio 2010, Express or full edition|
Microsoft Expression Blend 4.0 (optional)
|End-user hardware||Devices made for Surface 2.0, or |
Windows Touch computers
Did you find this information useful? Please send us your suggestions and comments.
© Microsoft Corporation. All rights reserved.