ScrollViewer.HorizontalSnapPointsType Property


Gets or sets a value that declares how manipulation behavior reacts to the snap points along the horizontal axis.

 property SnapPointsType HorizontalSnapPointsType { SnapPointsType get(); void set(SnapPointsType value); };
SnapPointsType HorizontalSnapPointsType();

void HorizontalSnapPointsType(SnapPointsType value);
public SnapPointsType HorizontalSnapPointsType { get; set; }
var snapPointsType = scrollViewer.horizontalSnapPointsType;
scrollViewer.horizontalSnapPointsType = snapPointsType;
Public Property HorizontalSnapPointsType As SnapPointsType
<ScrollViewer HorizontalSnapPointsType="snapPointsTypeMemberName" />

Property Value


A value of the enumeration. The default is None but might be set through a control template.


This XAML is from the default template for a Hub control. A Hub has a ScrollViewer part that surrounds an ItemsStackPanel for its content. Hub uses the Optional value for its snapping behavior in both dimensions (although VerticalScrollMode is disabled in starting visual states) and disables ZoomMode. Note how the SnapPointsAlignment properties are also set as attributes here.

<ControlTemplate TargetType="Hub">
<ScrollViewer x:Name="ScrollViewer"
  <ItemsStackPanel x:Name="Panel" 
       Orientation="{TemplateBinding Orientation}"
       CacheLength="20" />


For panning actions, there are often natural stopping places. Snap points provide a way to indicate where these places are. Then, when a user swipes, the manipulation result favors that natural point using behavior as expressed by a SnapPointsType value.

**Proximity points (Optional and OptionalSingle): ** When a user is going to naturally stop the manipulation in the proximity of a snap point, proximity points help the user land at the natural stopping place. Because the user has to land in proximity to the snap point to cause it to stop there, the user will sometimes have to perform another swipe to reach a snap point.

**Mandatory snap points (Mandatory and MandatorySingle): ** In contrast to proximity, mandatory snap points ensure that the content is adjusted to always land on a snap point. Even if the user releases the manipulation halfway between two snap-points, it will always move to one of the snap points.

To see the effects of snap points on ScrollViewer behavior yourself, get the XAML scrolling, panning and zooming sample. Run the sample on a touch device (not the simulator). Try out the SnapPointsType values when you view the "Panning with snap-points" example page of the sample.

To learn more about the swipe gesture and panning, see the "Panning behaviors" section of Guidelines for panning.

The default value of None is the default of the enumeration. If it's set, this property is often set as an attribute in a XAML template part, or as a style Setter. Each control potentially sets this differently. Getting the value at run time will provide the value that came from applied styles and templates.

Applies to

See also