Scroll​Viewer Scroll​Viewer Scroll​Viewer Class

Definition

Represents a scrollable area that can contain other visible elements.

public sealed class ScrollViewer : ContentControl, IScrollViewer, IScrollViewer2, IScrollViewer3public sealed class ScrollViewer : ContentControl, IScrollViewer, IScrollViewer2, IScrollViewer3Public NotInheritable Class ScrollViewer Inherits ContentControl Implements IScrollViewer, IScrollViewer2, IScrollViewer3
<ScrollViewer .../>
-or-
<ScrollViewer ...>
content
</ScrollViewer>
Inheritance
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Inherited Members

Inherited properties

Inherited events

Inherited methods

Remarks

ScrollViewer is a container control that lets the user pan and zoom its content.

Scroll viewer control

A ScrollViewer enables content to be displayed in a smaller area than its actual size. When the content of the ScrollViewer is not entirely visible, the ScrollViewer displays scrollbars that the user can use to move the content areas that is visible. The area that includes all of the content of the ScrollViewer is the extent. The visible area of the content is the viewport.

It's typical for a ScrollViewer control to exist as a composite part of other controls. A ScrollViewer part along with the ScrollContentPresenter class for support will display a viewport along with scrollbars only when the host control's layout space is being constrained smaller than the expanded content size. This is often the case for lists, so ListView and GridView templates always include a ScrollViewer. TextBox and RichEditBox also include a ScrollViewer in their templates.

When a ScrollViewer part in a control exists, the host control often has built-in event handling for certain input events and manipulations that enable the content to scroll. For example, a GridView interprets a swipe gesture and this causes the content to scroll horizontally. The input events and raw manipulations that the host control receives are considered handled by the control, and lower-level events such as PointerPressed won't be raised and won't bubble to any parent containers either. You can change some of the built-in control handling by overriding a control class and the On* virtual methods for events, or by retemplating the control. But in either case it's not trivial to reproduce the original default behavior, which is typically there so that the control reacts in expected ways to events and to a user's input actions and gestures. So you should consider whether you really need that input event to fire. You might want to investigate whether there are other input events or gestures that are not being control-handled, and use those in your app or control interaction design.

To make it possible for controls that include a ScrollViewer to influence some of the behavior and properties that are from within the ScrollViewer part, ScrollViewer defines a number of XAML attached properties that can be set in styles and used in template bindings.

ScrollViewer XAML attached properties

ScrollViewer defines the following XAML attached properties:

In order to support XAML processor access to the attached properties, and also to expose equivalent get and set operations to code, each XAML attached property has a pair of Get and Set accessor methods. For example, the GetHorizontalScrollMode and SetHorizontalScrollMode methods support and provide the equivalent code-only support for ScrollViewer.HorizontalScrollMode. Alternatively, you can use the dependency property system to get or set the value of the attached property. Call GetValue or SetValue, passing the arguments of the dependency property identifier to set, and a reference to the target object on which to get or set the value.

Control style and template

You can modify the default Style and ControlTemplate to give the control a unique appearance. For information about modifying a control's style and template, see Styling controls. The default style, template, and resources that define the look of the control are included in the generic.xaml file. For design purposes, generic.xaml is available in the (Program Files)\Windows Kits\10\DesignTime\CommonConfiguration\Neutral\UAP&lt;SDK version>\Generic folder from a Windows Software Development Kit (SDK) installation. Styles and resources from different versions of the SDK might have different values.

Starting in Windows 10, version 1607 (Windows Software Development Kit (SDK) version 10.0.14393.0), generic.xaml includes resources that you can use to modify the colors of a control in different visual states without modifying the control template. In apps that target this software development kit (SDK) or later, modifying these resources is preferred to setting properties such as Background and Foreground. For more info, see the Light-weight styling section of the Styling controls article.

This table shows the resources used by the ScrollViewer control.

Resource keyDescription
ScrollViewerScrollBarSeparatorBackgroundBackground color of the scrollbar separator

Windows 8 behavior

Gesture handling by track pad devices

For Windows 8, track pad device gestures that were input-handled by a ScrollViewer control part were interpreted as mouse wheel input, and thus would fire a PointerWheelChanged event. Starting with Windows 8.1, ScrollViewer uses an underlying manipulation logic that interprets track pad gestures as actions that the ScrollViewer responds to, and thus the gesture is considered handled by the control and the PointerWheelChanged event is not fired anymore.

If you migrate your app code from Windows 8 to Windows 8.1 you may want to account for this behavior change, because it results in PointerWheelChanged being fired in fewer cases. Also, the behavior that's now built-in to ScrollViewer may be duplicating what your handler would have done.

Apps that were compiled for Windows 8 but running on Windows 8.1 continue to use the Windows 8 behavior.

App UI for On-Screen Keyboard

Windows 8 had an internally implemented logic that would associate a ScrollViewer with the overall app UI whenever the user invokes the On-Screen Keyboard. This On-Screen Keyboard is a specific accessibility feature that users request through the Ease of Access Center. It's not the same as the soft keyboard that can appear in app UI for text input controls, if the system detects no keyboard device. What the internal ScrollViewer does here is to make it possible to scroll the area where the app is, if scrolling it is forced because the keyboard is taking UI space.

Starting with Windows 8.1, the system still has UI/layout behavior when the On-Screen Keyboard appears, but it no longer uses this internally created ScrollViewer. Instead it uses a dedicated internal control that app code can't change or inspect.

Most aspects of this behavior change don't affect apps at all. However, your app might have anticipated this behavior, by providing an implicit Style for ScrollViewer that's meant to change the layout, or by walking the tree with VisualTreeHelper to find this internally created ScrollViewer and alter it at run-time. For an app that is compiled for Windows 8.1 that code won't be useful.

Apps that were compiled for Windows 8 but running on Windows 8.1 continue to use the Windows 8 behavior.

Examples

The following XAML creates a large TextBlock inside a ScrollViewer, along with another copy of the TextBlock for comparison.

<StackPanel>
    <!-- A large TextBlock. -->
    <TextBlock Width="300" TextWrapping="Wrap" Margin="0,0,0,30" 
      Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed ac mi ipsum. Phasellus vel malesuada mauris. Donec pharetra, enim sit amet mattis tincidunt, felis nisi semper lectus, vel porta diam nisi in augue. Pellentesque lacus tortor, aliquam et faucibus id, rhoncus ut justo. Sed id lectus odio, eget pulvinar diam. Suspendisse eleifend ornare libero, in luctus purus aliquet non. Sed interdum, sem vitae rutrum rhoncus, felis ligula ultrices sem, in eleifend eros ante id neque." />
    
    <!-- The same large TextBlock, wrapped in a ScrollViewer. -->
    <ScrollViewer Height="200" Width="200" 
                  HorizontalScrollBarVisibility="Auto" 
                  VerticalScrollBarVisibility="Auto">
        <TextBlock Width="300" TextWrapping="Wrap"
            Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed ac mi ipsum. Phasellus vel malesuada mauris. Donec pharetra, enim sit amet mattis tincidunt, felis nisi semper lectus, vel porta diam nisi in augue. Pellentesque lacus tortor, aliquam et faucibus id, rhoncus ut justo. Sed id lectus odio, eget pulvinar diam. Suspendisse eleifend ornare libero, in luctus purus aliquet non. Sed interdum, sem vitae rutrum rhoncus, felis ligula ultrices sem, in eleifend eros ante id neque." />
    </ScrollViewer>
</StackPanel>

Constructors

ScrollViewer() ScrollViewer() ScrollViewer()

Initializes a new instance of the ScrollViewer class.

public ScrollViewer()public ScrollViewer()Public Sub New()
Attributes

Properties

BringIntoViewOnFocusChange BringIntoViewOnFocusChange BringIntoViewOnFocusChange

Gets or sets a value that determines whether the ScrollViewer uses a bring-into-view scroll behavior when an item in the view gets focus.

public bool BringIntoViewOnFocusChange { get; set; }public bool BringIntoViewOnFocusChange { get; set; }Public ReadWrite Property BringIntoViewOnFocusChange As bool
<ScrollViewer BringIntoViewOnFocusChange="bool" />
-or-
<object ScrollViewer.BringIntoViewOnFocusChange="bool"/>
Value
bool bool bool

true to use a behavior that brings focused items into view. false to use a behavior that focused items do not automatically scroll into view. The default is true.

Attributes

Remarks

For XAML usage, BringIntoViewOnFocusChange can either be an attribute on an explicit ScrollViewer element, or a ScrollViewer.BringIntoViewOnFocusChange attached property usage on an element that is a child of a control that supports scrollview implicitly in its template.

BringIntoViewOnFocusChangeProperty BringIntoViewOnFocusChangeProperty BringIntoViewOnFocusChangeProperty

Identifies the BringIntoViewOnFocusChange dependency property.

public static DependencyProperty BringIntoViewOnFocusChangeProperty { get; }public static DependencyProperty BringIntoViewOnFocusChangeProperty { get; }Public Static ReadOnly Property BringIntoViewOnFocusChangeProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the BringIntoViewOnFocusChange dependency property.

Attributes

ComputedHorizontalScrollBarVisibility ComputedHorizontalScrollBarVisibility ComputedHorizontalScrollBarVisibility

Gets a value that indicates whether the horizontal ScrollBar is visible.

public Visibility ComputedHorizontalScrollBarVisibility { get; }public Visibility ComputedHorizontalScrollBarVisibility { get; }Public ReadOnly Property ComputedHorizontalScrollBarVisibility As Visibility
Value
Visibility Visibility Visibility

A Visibility that indicates whether the horizontal scroll bar is visible. The default value is Hidden.

Attributes

ComputedHorizontalScrollBarVisibilityProperty ComputedHorizontalScrollBarVisibilityProperty ComputedHorizontalScrollBarVisibilityProperty

Identifies the ComputedHorizontalScrollBarVisibility dependency property.

public static DependencyProperty ComputedHorizontalScrollBarVisibilityProperty { get; }public static DependencyProperty ComputedHorizontalScrollBarVisibilityProperty { get; }Public Static ReadOnly Property ComputedHorizontalScrollBarVisibilityProperty As DependencyProperty
Attributes

ComputedVerticalScrollBarVisibility ComputedVerticalScrollBarVisibility ComputedVerticalScrollBarVisibility

Gets a value that indicates whether the vertical ScrollBar is visible.

public Visibility ComputedVerticalScrollBarVisibility { get; }public Visibility ComputedVerticalScrollBarVisibility { get; }Public ReadOnly Property ComputedVerticalScrollBarVisibility As Visibility
Value
Visibility Visibility Visibility

A Visibility that indicates whether the vertical scroll bar is visible. The default value is Visible.

Attributes

ComputedVerticalScrollBarVisibilityProperty ComputedVerticalScrollBarVisibilityProperty ComputedVerticalScrollBarVisibilityProperty

Identifies the ComputedVerticalScrollBarVisibility dependency property.

public static DependencyProperty ComputedVerticalScrollBarVisibilityProperty { get; }public static DependencyProperty ComputedVerticalScrollBarVisibilityProperty { get; }Public Static ReadOnly Property ComputedVerticalScrollBarVisibilityProperty As DependencyProperty
Attributes

ExtentHeight ExtentHeight ExtentHeight

Gets the vertical size of all the scrollable content in the ScrollViewer.

public double ExtentHeight { get; }public double ExtentHeight { get; }Public ReadOnly Property ExtentHeight As double
Value
double double double

The vertical size of all the scrollable content in the ScrollViewer.

Attributes

Remarks

The extent includes all the content in the ScrollViewer, whether visible or not. The viewport is the visible area of the content.

ExtentHeightProperty ExtentHeightProperty ExtentHeightProperty

Identifier for the ExtentHeight dependency property.

public static DependencyProperty ExtentHeightProperty { get; }public static DependencyProperty ExtentHeightProperty { get; }Public Static ReadOnly Property ExtentHeightProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the ExtentHeight dependency property.

Attributes

ExtentWidth ExtentWidth ExtentWidth

Gets the horizontal size of all the scrollable content in the ScrollViewer.

public double ExtentWidth { get; }public double ExtentWidth { get; }Public ReadOnly Property ExtentWidth As double
Value
double double double

The horizontal size of all the scrollable content in the ScrollViewer.

Attributes

Remarks

The extent includes all the content in the ScrollViewer, whether visible or not. The viewport is the visible area of the content.

ExtentWidthProperty ExtentWidthProperty ExtentWidthProperty

Identifier for the ExtentWidth dependency property.

public static DependencyProperty ExtentWidthProperty { get; }public static DependencyProperty ExtentWidthProperty { get; }Public Static ReadOnly Property ExtentWidthProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the ExtentWidth dependency property.

Attributes

HorizontalOffset HorizontalOffset HorizontalOffset

Gets the distance the content has been scrolled horizontally.

public double HorizontalOffset { get; }public double HorizontalOffset { get; }Public ReadOnly Property HorizontalOffset As double
Value
double double double

The distance the content has been scrolled horizontally.

Attributes

HorizontalOffsetProperty HorizontalOffsetProperty HorizontalOffsetProperty

Identifies the HorizontalOffset dependency property.

public static DependencyProperty HorizontalOffsetProperty { get; }public static DependencyProperty HorizontalOffsetProperty { get; }Public Static ReadOnly Property HorizontalOffsetProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the HorizontalOffset dependency property.

Attributes

HorizontalScrollBarVisibility HorizontalScrollBarVisibility HorizontalScrollBarVisibility

Gets or sets a value that indicates whether a horizontal ScrollBar should be displayed.

public ScrollBarVisibility HorizontalScrollBarVisibility { get; set; }public ScrollBarVisibility HorizontalScrollBarVisibility { get; set; }Public ReadWrite Property HorizontalScrollBarVisibility As ScrollBarVisibility
<ScrollViewer HorizontalScrollBarVisibility="scrollBarVisibilityMemberName"/>
-or-
<object ScrollViewer.HorizontalScrollBarVisibility="scrollBarVisibilityMemberName"/>
Value
ScrollBarVisibility ScrollBarVisibility ScrollBarVisibility

A ScrollBarVisibility value that indicates whether a horizontal ScrollBar should be displayed. The default value is Disabled.

Attributes

Remarks

For XAML usage, HorizontalScrollBarVisibility can either be an attribute on an explicit ScrollViewer element, or a ScrollViewer.HorizontalScrollBarVisibility attached property usage on an element that is a child of a control that supports scrollview implicitly in its template. Controls with a ScrollViewer as part of their composition typically use template binding such that setting the attached property at the level of the control will change the scroll behavior of the ScrollViewer part within the control. Otherwise, it may be necessary to replace the template in order to change the scroll behavior of a ScrollViewer part.

HorizontalScrollBarVisibilityProperty HorizontalScrollBarVisibilityProperty HorizontalScrollBarVisibilityProperty

Identifies the HorizontalScrollBarVisibility dependency property.

public static DependencyProperty HorizontalScrollBarVisibilityProperty { get; }public static DependencyProperty HorizontalScrollBarVisibilityProperty { get; }Public Static ReadOnly Property HorizontalScrollBarVisibilityProperty As DependencyProperty
Attributes

HorizontalScrollMode HorizontalScrollMode HorizontalScrollMode

Gets or sets a value that determines how manipulation input influences scrolling behavior on the horizontal axis.

public ScrollMode HorizontalScrollMode { get; set; }public ScrollMode HorizontalScrollMode { get; set; }Public ReadWrite Property HorizontalScrollMode As ScrollMode
<ScrollViewer HorizontalScrollMode="scrollModeMemberName" />
-or-
<object ScrollViewer.HorizontalScrollMode="scrollModeMemberName"/>
Value
ScrollMode ScrollMode ScrollMode

A value of the enumeration. The typical default (as set through the default template, not class initialization) is Enabled.

Attributes

Remarks

Scrolling behavior can also be set through a ScrollViewer.HorizontalScrollMode XAML attached property usage, or by calling SetHorizontalScrollMode. This is for cases where the ScrollViewer is implicit, such as when the ScrollViewer exists in the default template for a GridView, and you want to be able to influence the scrolling behavior without accessing template parts. Controls with a ScrollViewer as part of their composition typically use template binding such that setting the attached property at the level of the control will change the scroll behavior of the ScrollViewer part within the control. Otherwise, it may be necessary to replace the template in order to change the scroll behavior of a ScrollViewer part.

HorizontalScrollModeProperty HorizontalScrollModeProperty HorizontalScrollModeProperty

Identifies the HorizontalScrollMode dependency property.

public static DependencyProperty HorizontalScrollModeProperty { get; }public static DependencyProperty HorizontalScrollModeProperty { get; }Public Static ReadOnly Property HorizontalScrollModeProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the HorizontalScrollMode dependency property.

Attributes

HorizontalSnapPointsAlignment HorizontalSnapPointsAlignment HorizontalSnapPointsAlignment

Gets or sets a value that indicates how the existing snap points are horizontally aligned versus the initial viewport.

public SnapPointsAlignment HorizontalSnapPointsAlignment { get; set; }public SnapPointsAlignment HorizontalSnapPointsAlignment { get; set; }Public ReadWrite Property HorizontalSnapPointsAlignment As SnapPointsAlignment
<ScrollViewer HorizontalSnapPointsAlignment="snapPointsAlignmentMemberName" />
Value
SnapPointsAlignment SnapPointsAlignment SnapPointsAlignment

A value of the enumeration.

Attributes

HorizontalSnapPointsAlignmentProperty HorizontalSnapPointsAlignmentProperty HorizontalSnapPointsAlignmentProperty

Identifies the HorizontalSnapPointsAlignment dependency property.

public static DependencyProperty HorizontalSnapPointsAlignmentProperty { get; }public static DependencyProperty HorizontalSnapPointsAlignmentProperty { get; }Public Static ReadOnly Property HorizontalSnapPointsAlignmentProperty As DependencyProperty
Attributes

HorizontalSnapPointsType HorizontalSnapPointsType HorizontalSnapPointsType

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

public SnapPointsType HorizontalSnapPointsType { get; set; }public SnapPointsType HorizontalSnapPointsType { get; set; }Public ReadWrite Property HorizontalSnapPointsType As SnapPointsType
<ScrollViewer HorizontalSnapPointsType="snapPointsTypeMemberName" />
Value
SnapPointsType SnapPointsType SnapPointsType

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

Attributes

Remarks

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.

Examples

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"
    Grid.RowSpan="2"
    HorizontalScrollMode="Auto"
    HorizontalScrollBarVisibility="Auto"
    VerticalScrollMode="Disabled"
    VerticalScrollBarVisibility="Disabled"
    HorizontalSnapPointsAlignment="Near"
    HorizontalSnapPointsType="Optional"
    VerticalSnapPointsAlignment="Near"
    VerticalSnapPointsType="Optional"
    ZoomMode="Disabled">
  <ItemsStackPanel x:Name="Panel" 
       Orientation="{TemplateBinding Orientation}"
       CacheLength="20" />
</ScrollViewer>
...
</ControlTemplate>
See Also

HorizontalSnapPointsTypeProperty HorizontalSnapPointsTypeProperty HorizontalSnapPointsTypeProperty

Identifies the HorizontalSnapPointsType dependency property.

public static DependencyProperty HorizontalSnapPointsTypeProperty { get; }public static DependencyProperty HorizontalSnapPointsTypeProperty { get; }Public Static ReadOnly Property HorizontalSnapPointsTypeProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the HorizontalSnapPointsType dependency property.

Attributes

IsDeferredScrollingEnabled IsDeferredScrollingEnabled IsDeferredScrollingEnabled

Gets or sets a value that determines the deferred scrolling behavior for a ScrollViewer.

public bool IsDeferredScrollingEnabled { get; set; }public bool IsDeferredScrollingEnabled { get; set; }Public ReadWrite Property IsDeferredScrollingEnabled As bool
<ScrollViewer IsDeferredScrollingEnabled="bool" />
-or-
<object ScrollViewer.IsDeferredScrollingEnabled="bool"/>
Value
bool bool bool

true if deferred scrolling should occur; otherwise, false.

Attributes

Remarks

Deferred scrolling behavior means that the view does not scroll until a user action is completed. For example, if a region scrolls when the user manipulates a thumb control, and IsDeferredScrollingEnabled is true, the scroll does not occur until the touch point on the thumb is released. In contrast, if IsDeferredScrollingEnabled is false, the region scrolls any time that the touch point selection point along the slider track is moved.

For XAML usage, IsDeferredScrollingEnabled can either be an attribute on an explicit ScrollViewer element, or a ScrollViewer.IsDeferredScrollingEnabled attached property usage on an element that is a child of a control that supports scrollview implicitly in its template.

IsDeferredScrollingEnabledProperty IsDeferredScrollingEnabledProperty IsDeferredScrollingEnabledProperty

Identifies the IsDeferredScrollingEnabled dependency property.

public static DependencyProperty IsDeferredScrollingEnabledProperty { get; }public static DependencyProperty IsDeferredScrollingEnabledProperty { get; }Public Static ReadOnly Property IsDeferredScrollingEnabledProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the IsDeferredScrollingEnabled dependency property.

Attributes

IsHorizontalRailEnabled IsHorizontalRailEnabled IsHorizontalRailEnabled

Gets or sets a value that indicates whether the scroll rail is enabled for the horizontal axis.

public bool IsHorizontalRailEnabled { get; set; }public bool IsHorizontalRailEnabled { get; set; }Public ReadWrite Property IsHorizontalRailEnabled As bool
<ScrollViewer IsHorizontalRailEnabled="bool" />
-or-
<object ScrollViewer.IsHorizontalRailEnabled="bool"/>
Value
bool bool bool

True to enable the horizontal scroll rail; otherwise, false. The default is true.

Attributes

IsHorizontalRailEnabledProperty IsHorizontalRailEnabledProperty IsHorizontalRailEnabledProperty

Identifies the IsHorizontalRailEnabled dependency property.

public static DependencyProperty IsHorizontalRailEnabledProperty { get; }public static DependencyProperty IsHorizontalRailEnabledProperty { get; }Public Static ReadOnly Property IsHorizontalRailEnabledProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the IsHorizontalRailEnabled dependency property.

Attributes

IsHorizontalScrollChainingEnabled IsHorizontalScrollChainingEnabled IsHorizontalScrollChainingEnabled

Gets or sets a value that indicates whether scroll chaining is enabled from this child to its parent, for the horizontal axis.

public bool IsHorizontalScrollChainingEnabled { get; set; }public bool IsHorizontalScrollChainingEnabled { get; set; }Public ReadWrite Property IsHorizontalScrollChainingEnabled As bool
<ScrollViewer IsHorizontalScrollChainingEnabled="bool" />
-or-
<object ScrollViewer.IsHorizontalScrollChainingEnabled="bool"/>

Value
bool bool bool

true to enable horizontal scroll chaining from child to parent; otherwise, false.

Attributes

Remarks

For XAML usage, IsHorizontalScrollChainingEnabled can either be an attribute on an explicit ScrollViewer element, or a ScrollViewer.IsHorizontalScrollChainingEnabled attached property usage on an element that is a child of a control that supports scrollview implicitly in its template.

IsHorizontalScrollChainingEnabledProperty IsHorizontalScrollChainingEnabledProperty IsHorizontalScrollChainingEnabledProperty

Identifies the IsHorizontalScrollChainingEnabled dependency property.

public static DependencyProperty IsHorizontalScrollChainingEnabledProperty { get; }public static DependencyProperty IsHorizontalScrollChainingEnabledProperty { get; }Public Static ReadOnly Property IsHorizontalScrollChainingEnabledProperty As DependencyProperty
Attributes

IsScrollInertiaEnabled IsScrollInertiaEnabled IsScrollInertiaEnabled

Gets or sets a value that indicates whether scroll actions should include inertia in their behavior and value.

public bool IsScrollInertiaEnabled { get; set; }public bool IsScrollInertiaEnabled { get; set; }Public ReadWrite Property IsScrollInertiaEnabled As bool
<ScrollViewer IsScrollInertiaEnabled="bool" />
-or-
<object ScrollViewer.IsScrollInertiaEnabled="bool"/>
Value
bool bool bool

true if scroll actions should include inertia in their behavior and value; otherwise, false.

Attributes

Remarks

For XAML usage, IsScrollInertiaEnabled can either be an attribute on an explicit ScrollViewer element, or a ScrollViewer.IsScrollInertiaEnabled attached property usage on an element that is a child of a control that supports scrollview implicitly in its template.

IsScrollInertiaEnabledProperty IsScrollInertiaEnabledProperty IsScrollInertiaEnabledProperty

Identifies the IsScrollInertiaEnabled dependency property.

public static DependencyProperty IsScrollInertiaEnabledProperty { get; }public static DependencyProperty IsScrollInertiaEnabledProperty { get; }Public Static ReadOnly Property IsScrollInertiaEnabledProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the IsScrollInertiaEnabled dependency property.

Attributes

IsVerticalRailEnabled IsVerticalRailEnabled IsVerticalRailEnabled

Gets or sets a value that indicates whether the scroll rail is enabled for the vertical axis.

public bool IsVerticalRailEnabled { get; set; }public bool IsVerticalRailEnabled { get; set; }Public ReadWrite Property IsVerticalRailEnabled As bool
<ScrollViewer IsVerticalRailEnabled="bool" />
-or-
<object ScrollViewer.IsVerticalRailEnabled="bool"/>
Value
bool bool bool

True to enable the vertical scroll rail; otherwise, false. The default is true.

Attributes

IsVerticalRailEnabledProperty IsVerticalRailEnabledProperty IsVerticalRailEnabledProperty

Identifies the IsVerticalRailEnabled dependency property.

public static DependencyProperty IsVerticalRailEnabledProperty { get; }public static DependencyProperty IsVerticalRailEnabledProperty { get; }Public Static ReadOnly Property IsVerticalRailEnabledProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the IsVerticalRailEnabled dependency property.

Attributes

IsVerticalScrollChainingEnabled IsVerticalScrollChainingEnabled IsVerticalScrollChainingEnabled

Gets or sets a value that indicates whether scroll chaining is enabled from this child to its parent, for the vertical axis.

public bool IsVerticalScrollChainingEnabled { get; set; }public bool IsVerticalScrollChainingEnabled { get; set; }Public ReadWrite Property IsVerticalScrollChainingEnabled As bool
<ScrollViewer IsVerticalScrollChainingEnabled="bool" />
-or-
<object ScrollViewer.IsVerticalScrollChainingEnabled="bool"/>
Value
bool bool bool

true to enable vertical scroll chaining from child to parent; otherwise, false.

Attributes

Remarks

For XAML usage, IsVerticalScrollChainingEnabled can either be an attribute on an explicit ScrollViewer element, or a ScrollViewer.IsVerticalScrollChainingEnabled attached property usage on an element that is a child of a control that supports scrollview implicitly in its template.

IsVerticalScrollChainingEnabledProperty IsVerticalScrollChainingEnabledProperty IsVerticalScrollChainingEnabledProperty

Identifies the IsVerticalScrollChainingEnabled dependency property.

public static DependencyProperty IsVerticalScrollChainingEnabledProperty { get; }public static DependencyProperty IsVerticalScrollChainingEnabledProperty { get; }Public Static ReadOnly Property IsVerticalScrollChainingEnabledProperty As DependencyProperty
Attributes

IsZoomChainingEnabled IsZoomChainingEnabled IsZoomChainingEnabled

Gets or sets a value that indicates whether zoom chaining is enabled from this child to its parent.

public bool IsZoomChainingEnabled { get; set; }public bool IsZoomChainingEnabled { get; set; }Public ReadWrite Property IsZoomChainingEnabled As bool
<ScrollViewer IsZoomChainingEnabled="bool" />
-or-
<object ScrollViewer.IsZoomChainingEnabled="bool"/>
Value
bool bool bool

true to enable zoom chaining from child to parent; otherwise, false.

Attributes

Remarks

For XAML usage, IsZoomChainingEnabled can either be an attribute on an explicit ScrollViewer element, or a ScrollViewer.IsZoomChainingEnabled attached property usage on an element that is a child of a control that supports scrollview implicitly in its template.

IsZoomChainingEnabledProperty IsZoomChainingEnabledProperty IsZoomChainingEnabledProperty

Identifies the IsZoomChainingEnabled dependency property.

public static DependencyProperty IsZoomChainingEnabledProperty { get; }public static DependencyProperty IsZoomChainingEnabledProperty { get; }Public Static ReadOnly Property IsZoomChainingEnabledProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the IsZoomChainingEnabled dependency property.

Attributes

IsZoomInertiaEnabled IsZoomInertiaEnabled IsZoomInertiaEnabled

Gets or sets a value that indicates whether zoom actions should include inertia in their behavior and value.

public bool IsZoomInertiaEnabled { get; set; }public bool IsZoomInertiaEnabled { get; set; }Public ReadWrite Property IsZoomInertiaEnabled As bool
<ScrollViewer IsZoomInertiaEnabled="bool" />
-or-
<object ScrollViewer.IsZoomInertiaEnabled="bool"/>
Value
bool bool bool

true if zoom actions should include inertia in their behavior and value; otherwise, false.

Attributes

Remarks

For XAML usage, IsZoomInertiaEnabled can either be an attribute on an explicit ScrollViewer element, or a ScrollViewer.IsZoomInertiaEnabled attached property usage on an element that is a child of a control that supports scrollview implicitly in its template.

IsZoomInertiaEnabledProperty IsZoomInertiaEnabledProperty IsZoomInertiaEnabledProperty

Identifies the IsZoomInertiaEnabled dependency property.

public static DependencyProperty IsZoomInertiaEnabledProperty { get; }public static DependencyProperty IsZoomInertiaEnabledProperty { get; }Public Static ReadOnly Property IsZoomInertiaEnabledProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the IsZoomInertiaEnabled dependency property.

Attributes

LeftHeader LeftHeader LeftHeader

Gets or sets the content of the left header.

public UIElement LeftHeader { get; set; }public UIElement LeftHeader { get; set; }Public ReadWrite Property LeftHeader As UIElement
<ScrollViewer>
  <ScrollViewer.LeftHeader>headerObject</ScrollViewer.LeftHeader>
</ScrollViewer>

Value
UIElement UIElement UIElement

The content of the left header.

Attributes

Remarks

The LeftHeader, TopHeader, and TopLeftHeader properties can be set only when ScrollViewer content's HorizontalAlignment is Left and VerticalAlignment is Top.

The left header scrolls vertically, but not horizontally.

LeftHeaderProperty LeftHeaderProperty LeftHeaderProperty

Identifies the LeftHeader dependency property.

public static DependencyProperty LeftHeaderProperty { get; }public static DependencyProperty LeftHeaderProperty { get; }Public Static ReadOnly Property LeftHeaderProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the LeftHeader dependency property.

Attributes

MaxZoomFactor MaxZoomFactor MaxZoomFactor

Gets or sets a value that indicates the maximum permitted run-time value of ZoomFactor.

public float MaxZoomFactor { get; set; }public float MaxZoomFactor { get; set; }Public ReadWrite Property MaxZoomFactor As float
<ScrollViewer MaxZoomFactor="single" />
Value
float float float

The maximum permitted run-time value of ZoomFactor. The default is 10.

Attributes

MaxZoomFactorProperty MaxZoomFactorProperty MaxZoomFactorProperty

Identifies the MaxZoomFactor dependency property.

public static DependencyProperty MaxZoomFactorProperty { get; }public static DependencyProperty MaxZoomFactorProperty { get; }Public Static ReadOnly Property MaxZoomFactorProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the MaxZoomFactor dependency property.

Attributes

MinZoomFactor MinZoomFactor MinZoomFactor

Gets or sets a value that indicates the minimum permitted run-time value of ZoomFactor.

public float MinZoomFactor { get; set; }public float MinZoomFactor { get; set; }Public ReadWrite Property MinZoomFactor As float
<ScrollViewer MinZoomFactor="single" />
Value
float float float

The minimum permitted run-time value of ZoomFactor. The default is 0.1.

Attributes

MinZoomFactorProperty MinZoomFactorProperty MinZoomFactorProperty

Identifies the MinZoomFactor dependency property.

public static DependencyProperty MinZoomFactorProperty { get; }public static DependencyProperty MinZoomFactorProperty { get; }Public Static ReadOnly Property MinZoomFactorProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the MinZoomFactor dependency property.

Attributes

ScrollableHeight ScrollableHeight ScrollableHeight

Gets a value that represents the vertical size of the area that can be scrolled; the difference between the width of the extent and the width of the viewport.

public double ScrollableHeight { get; }public double ScrollableHeight { get; }Public ReadOnly Property ScrollableHeight As double
Value
double double double

The vertical size of the area that can be scrolled. This property has no default value.

Attributes

ScrollableHeightProperty ScrollableHeightProperty ScrollableHeightProperty

Identifies the ScrollableHeight dependency property.

public static DependencyProperty ScrollableHeightProperty { get; }public static DependencyProperty ScrollableHeightProperty { get; }Public Static ReadOnly Property ScrollableHeightProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the ScrollableHeight dependency property.

Attributes

ScrollableWidth ScrollableWidth ScrollableWidth

Gets a value that represents the horizontal size of the area that can be scrolled; the difference between the width of the extent and the width of the viewport.

public double ScrollableWidth { get; }public double ScrollableWidth { get; }Public ReadOnly Property ScrollableWidth As double
Value
double double double

The horizontal size of the area that can be scrolled. This property has no default value.

Attributes

ScrollableWidthProperty ScrollableWidthProperty ScrollableWidthProperty

Identifies the ScrollableWidth dependency property.

public static DependencyProperty ScrollableWidthProperty { get; }public static DependencyProperty ScrollableWidthProperty { get; }Public Static ReadOnly Property ScrollableWidthProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the ScrollableWidth dependency property.

Attributes

TopHeader TopHeader TopHeader

Gets or sets the content of the top header.

public UIElement TopHeader { get; set; }public UIElement TopHeader { get; set; }Public ReadWrite Property TopHeader As UIElement
<ScrollViewer>
  <ScrollViewer.TopHeader>headerObject</ScrollViewer.TopHeader>
</ScrollViewer>

Value
UIElement UIElement UIElement

The content of the top header.

Attributes

Remarks

The LeftHeader, TopHeader, and TopLeftHeader properties can be set only when ScrollViewer content's HorizontalAlignment is Left and VerticalAlignment is Top.

The top header scrolls horizontally, but not vertically.

TopHeaderProperty TopHeaderProperty TopHeaderProperty

Identifies the TopHeader dependency property.

public static DependencyProperty TopHeaderProperty { get; }public static DependencyProperty TopHeaderProperty { get; }Public Static ReadOnly Property TopHeaderProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the TopHeader dependency property.

Attributes

TopLeftHeader TopLeftHeader TopLeftHeader

Gets or sets the content of the top, left header.

public UIElement TopLeftHeader { get; set; }public UIElement TopLeftHeader { get; set; }Public ReadWrite Property TopLeftHeader As UIElement
<ScrollViewer>
  <ScrollViewer.TopLeftHeader>headerObject</ScrollViewer.TopLeftHeader>
</ScrollViewer>

Value
UIElement UIElement UIElement

The content of the top, left header.

Attributes

Remarks

The LeftHeader, TopHeader, and TopLeftHeader properties can be set only when ScrollViewer content's HorizontalAlignment is Left and VerticalAlignment is Top.

The top left header doesn't scroll in any direction.

TopLeftHeaderProperty TopLeftHeaderProperty TopLeftHeaderProperty

Identifies the TopLeftHeader dependency property.

public static DependencyProperty TopLeftHeaderProperty { get; }public static DependencyProperty TopLeftHeaderProperty { get; }Public Static ReadOnly Property TopLeftHeaderProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the TopLeftHeader dependency property.

Attributes

VerticalOffset VerticalOffset VerticalOffset

Gets the distance the content has been scrolled vertically.

public double VerticalOffset { get; }public double VerticalOffset { get; }Public ReadOnly Property VerticalOffset As double
Value
double double double

The distance the content has been scrolled vertically.

Attributes

VerticalOffsetProperty VerticalOffsetProperty VerticalOffsetProperty

Identifies the VerticalOffset dependency property.

public static DependencyProperty VerticalOffsetProperty { get; }public static DependencyProperty VerticalOffsetProperty { get; }Public Static ReadOnly Property VerticalOffsetProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the VerticalOffset dependency property.

Attributes

VerticalScrollBarVisibility VerticalScrollBarVisibility VerticalScrollBarVisibility

Gets or sets a value that indicates whether a vertical ScrollBar should be displayed.

public ScrollBarVisibility VerticalScrollBarVisibility { get; set; }public ScrollBarVisibility VerticalScrollBarVisibility { get; set; }Public ReadWrite Property VerticalScrollBarVisibility As ScrollBarVisibility
<ScrollViewer VerticalScrollBarVisibility="scrollBarVisibilityMemberName"/>
-or-
<object ScrollViewer.VerticalScrollBarVisibility="scrollBarVisibilityMemberName"/>
Value
ScrollBarVisibility ScrollBarVisibility ScrollBarVisibility

A ScrollBarVisibility value that indicates whether a vertical ScrollBar should be displayed. The default value is Visible.

Attributes

Remarks

Scrolling behavior can also be set through a ScrollViewer.VerticalScrollBarVisibility XAML attached property usage, or by calling SetVerticalScrollBarVisibility. This is for cases where the ScrollViewer is implicit, such as when the ScrollViewer exists in the default template for a GridView, and you want to be able to influence the scrolling behavior without accessing template parts. Controls with a ScrollViewer as part of their composition typically use template binding such that setting the attached property at the level of the control will change the scroll behavior of the ScrollViewer part within the control. Otherwise, it may be necessary to replace the template in order to change the scroll behavior of a ScrollViewer part.

VerticalScrollBarVisibilityProperty VerticalScrollBarVisibilityProperty VerticalScrollBarVisibilityProperty

Identifies the VerticalScrollBarVisibility dependency property.

public static DependencyProperty VerticalScrollBarVisibilityProperty { get; }public static DependencyProperty VerticalScrollBarVisibilityProperty { get; }Public Static ReadOnly Property VerticalScrollBarVisibilityProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the VerticalScrollBarVisibility dependency property.

Attributes

VerticalScrollMode VerticalScrollMode VerticalScrollMode

Gets or sets a value that determines how manipulation input influences scrolling behavior on the vertical axis.

public ScrollMode VerticalScrollMode { get; set; }public ScrollMode VerticalScrollMode { get; set; }Public ReadWrite Property VerticalScrollMode As ScrollMode
<ScrollViewer VerticalScrollMode="scrollModeMemberName" />
-or-
<object ScrollViewer.VerticalScrollMode="scrollModeMemberName"/>
Value
ScrollMode ScrollMode ScrollMode

A value of the enumeration. The typical default (as set through the default template, not class initialization) is Enabled.

Attributes

Remarks

Scrolling behavior can also be set through a ScrollViewer.VerticalScrollMode XAML attached property usage, or by calling SetVerticalScrollMode. This is for cases where the ScrollViewer is implicit, such as when the ScrollViewer exists in the default template for a GridView, and you want to be able to influence the scrolling behavior without accessing template parts. Controls with a ScrollViewer as part of their composition typically use template binding such that setting the attached property at the level of the control will change the scroll behavior of the ScrollViewer part within the control. Otherwise, it may be necessary to replace the template in order to change the scroll behavior of a ScrollViewer part.

VerticalScrollModeProperty VerticalScrollModeProperty VerticalScrollModeProperty

Identifies the VerticalScrollMode dependency property.

public static DependencyProperty VerticalScrollModeProperty { get; }public static DependencyProperty VerticalScrollModeProperty { get; }Public Static ReadOnly Property VerticalScrollModeProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the VerticalScrollMode dependency property.

Attributes

VerticalSnapPointsAlignment VerticalSnapPointsAlignment VerticalSnapPointsAlignment

Gets or sets a value that indicates how the existing snap points are vertically aligned versus the initial viewport.

public SnapPointsAlignment VerticalSnapPointsAlignment { get; set; }public SnapPointsAlignment VerticalSnapPointsAlignment { get; set; }Public ReadWrite Property VerticalSnapPointsAlignment As SnapPointsAlignment
<ScrollViewer VerticalSnapPointsAlignment="snapPointsAlignmentMemberName" />
Value
SnapPointsAlignment SnapPointsAlignment SnapPointsAlignment

A value of the enumeration.

Attributes

VerticalSnapPointsAlignmentProperty VerticalSnapPointsAlignmentProperty VerticalSnapPointsAlignmentProperty

Identifies the VerticalSnapPointsAlignment dependency property.

public static DependencyProperty VerticalSnapPointsAlignmentProperty { get; }public static DependencyProperty VerticalSnapPointsAlignmentProperty { get; }Public Static ReadOnly Property VerticalSnapPointsAlignmentProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the VerticalSnapPointsAlignment dependency property.

Attributes

VerticalSnapPointsType VerticalSnapPointsType VerticalSnapPointsType

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

public SnapPointsType VerticalSnapPointsType { get; set; }public SnapPointsType VerticalSnapPointsType { get; set; }Public ReadWrite Property VerticalSnapPointsType As SnapPointsType
<ScrollViewer VerticalSnapPointsType="snapPointsTypeMemberName" />
Value
SnapPointsType SnapPointsType SnapPointsType

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

Attributes

Remarks

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.

Examples

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"
    Grid.RowSpan="2"
    HorizontalScrollMode="Auto"
    HorizontalScrollBarVisibility="Auto"
    VerticalScrollMode="Disabled"
    VerticalScrollBarVisibility="Disabled"
    HorizontalSnapPointsAlignment="Near"
    HorizontalSnapPointsType="Optional"
    VerticalSnapPointsAlignment="Near"
    VerticalSnapPointsType="Optional"
    ZoomMode="Disabled">
  <ItemsStackPanel x:Name="Panel" 
       Orientation="{TemplateBinding Orientation}"
       CacheLength="20" />
</ScrollViewer>
...
</ControlTemplate>
See Also

VerticalSnapPointsTypeProperty VerticalSnapPointsTypeProperty VerticalSnapPointsTypeProperty

Identifies the VerticalSnapPointsType dependency property.

public static DependencyProperty VerticalSnapPointsTypeProperty { get; }public static DependencyProperty VerticalSnapPointsTypeProperty { get; }Public Static ReadOnly Property VerticalSnapPointsTypeProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the VerticalSnapPointsType dependency property.

Attributes

ViewportHeight ViewportHeight ViewportHeight

Gets the vertical size of the viewable content.

public double ViewportHeight { get; }public double ViewportHeight { get; }Public ReadOnly Property ViewportHeight As double
Value
double double double

The vertical size of the viewable content.

Attributes

Remarks

The viewport includes all the visible content in the ScrollViewer.

ViewportHeightProperty ViewportHeightProperty ViewportHeightProperty

Identifies the ViewportHeight dependency property.

public static DependencyProperty ViewportHeightProperty { get; }public static DependencyProperty ViewportHeightProperty { get; }Public Static ReadOnly Property ViewportHeightProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the ViewportHeight dependency property.

Attributes

ViewportWidth ViewportWidth ViewportWidth

Gets the horizontal size of the viewable content.

public double ViewportWidth { get; }public double ViewportWidth { get; }Public ReadOnly Property ViewportWidth As double
Value
double double double

The horizontal size of the viewable content.

Attributes

Remarks

The viewport includes all the visible content in the ScrollViewer.

ViewportWidthProperty ViewportWidthProperty ViewportWidthProperty

Identifies the ViewportWidth dependency property.

public static DependencyProperty ViewportWidthProperty { get; }public static DependencyProperty ViewportWidthProperty { get; }Public Static ReadOnly Property ViewportWidthProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the ViewportWidth dependency property.

Attributes

ZoomFactor ZoomFactor ZoomFactor

Gets a value that indicates the current zoom factor engaged for content scaling.

public float ZoomFactor { get; }public float ZoomFactor { get; }Public ReadOnly Property ZoomFactor As float
Value
float float float

The current zoom factor engaged for content scaling. The default is 1.0, where 1.0 indicates no additional scaling.

Attributes

Remarks

To change the value of this property at run-time or for initialization, use ZoomToFactor.

ZoomFactorProperty ZoomFactorProperty ZoomFactorProperty

Identifies the ZoomFactor dependency property.

public static DependencyProperty ZoomFactorProperty { get; }public static DependencyProperty ZoomFactorProperty { get; }Public Static ReadOnly Property ZoomFactorProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the ZoomFactor dependency property.

Attributes

ZoomMode ZoomMode ZoomMode

Gets or sets a value that indicates whether zoom behavior in the ScrollViewer content is enabled.

public ZoomMode ZoomMode { get; set; }public ZoomMode ZoomMode { get; set; }Public ReadWrite Property ZoomMode As ZoomMode
<ScrollViewer ZoomMode="zoomModeMemberName" />
-or-
<object ScrollViewer.ZoomMode="zoomModeMemberName"/>
Value
ZoomMode ZoomMode ZoomMode

A value of the enumeration.

Attributes

Remarks

No default value is listed for this property. Controls that incorporate a ScrollViewer in compositing often set a value for ZoomMode in the default template and starting visual states, and it is this templated value that you will typically start with. Controls with a ScrollViewer as part of their composition typically use template binding such that setting the attached property at the level of the control will change the scroll behavior of the ScrollViewer part within the control. Otherwise, it may be necessary to replace the template in order to change the scroll behavior of a ScrollViewer part.

ZoomModeProperty ZoomModeProperty ZoomModeProperty

Identifies the ZoomMode dependency property.

public static DependencyProperty ZoomModeProperty { get; }public static DependencyProperty ZoomModeProperty { get; }Public Static ReadOnly Property ZoomModeProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the ZoomMode dependency property.

Attributes

ZoomSnapPoints ZoomSnapPoints ZoomSnapPoints

Gets the observable collection of zoom snap point factors that are held by the ScrollViewer.

public IVector<float> ZoomSnapPoints { get; }public IVector<float> ZoomSnapPoints { get; }Public ReadOnly Property ZoomSnapPoints As IVector<float>
Value

A collection of Single values that represent zoom factors as snap points.

Attributes

ZoomSnapPointsProperty ZoomSnapPointsProperty ZoomSnapPointsProperty

Identifies the ZoomSnapPoints dependency property.

public static DependencyProperty ZoomSnapPointsProperty { get; }public static DependencyProperty ZoomSnapPointsProperty { get; }Public Static ReadOnly Property ZoomSnapPointsProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the ZoomSnapPoints dependency property.

Attributes

ZoomSnapPointsType ZoomSnapPointsType ZoomSnapPointsType

Gets or sets a value that indicates how zoom snap points are processed for interaction input.

public SnapPointsType ZoomSnapPointsType { get; set; }public SnapPointsType ZoomSnapPointsType { get; set; }Public ReadWrite Property ZoomSnapPointsType As SnapPointsType
<ScrollViewer ZoomSnapPointsType="snapPointsTypeMemberName"/>
Value
SnapPointsType SnapPointsType SnapPointsType

A value of the enumeration.

Attributes

ZoomSnapPointsTypeProperty ZoomSnapPointsTypeProperty ZoomSnapPointsTypeProperty

Identifies the ZoomSnapPointsType dependency property.

public static DependencyProperty ZoomSnapPointsTypeProperty { get; }public static DependencyProperty ZoomSnapPointsTypeProperty { get; }Public Static ReadOnly Property ZoomSnapPointsTypeProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the ZoomSnapPointsType dependency property.

Attributes

Methods

ChangeView(IReference<Double>, IReference<Double>, IReference<Single>) ChangeView(IReference<Double>, IReference<Double>, IReference<Single>) ChangeView(IReference<Double>, IReference<Double>, IReference<Single>)

Causes the ScrollViewer to load a new view into the viewport using the specified offsets and zoom factor.

public bool ChangeView(IReference<Double> horizontalOffset, IReference<Double> verticalOffset, IReference<Single> zoomFactor)public bool ChangeView(IReference<Double> horizontalOffset, IReference<Double> verticalOffset, IReference<Single> zoomFactor)Public Function ChangeView(horizontalOffset As IReference<Double>, verticalOffset As IReference<Double>, zoomFactor As IReference<Single>) As bool
Parameters
horizontalOffset

A value between 0 and ScrollableWidth that specifies the distance the content should be scrolled horizontally.

verticalOffset

A value between 0 and ScrollableHeight that specifies the distance the content should be scrolled vertically.

zoomFactor

A value between MinZoomFactor and MaxZoomFactor that specifies the required target ZoomFactor.

Returns
bool bool bool

true if the view is changed; otherwise, false.

Attributes

Remarks

You can set parameter values to null to use this method to scroll only horizontally, only vertically, or to only change the zoom factor.

Examples

This code results in a ScrollViewer named myScrollViewer being scrolled to a horizontal offset of 2.

bool flag = myScrollViewer.ChangeView(2, null, null); 

ChangeView(IReference<Double>, IReference<Double>, IReference<Single>, Boolean) ChangeView(IReference<Double>, IReference<Double>, IReference<Single>, Boolean) ChangeView(IReference<Double>, IReference<Double>, IReference<Single>, Boolean)

Causes the ScrollViewer to load a new view into the viewport using the specified offsets and zoom factor, and optionally disables scrolling animation.

public bool ChangeView(IReference<Double> horizontalOffset, IReference<Double> verticalOffset, IReference<Single> zoomFactor, Boolean disableAnimation)public bool ChangeView(IReference<Double> horizontalOffset, IReference<Double> verticalOffset, IReference<Single> zoomFactor, Boolean disableAnimation)Public Function ChangeView(horizontalOffset As IReference<Double>, verticalOffset As IReference<Double>, zoomFactor As IReference<Single>, disableAnimation As Boolean) As bool
Parameters
horizontalOffset

A value between 0 and ScrollableWidth that specifies the distance the content should be scrolled horizontally.

verticalOffset

A value between 0 and ScrollableHeight that specifies the distance the content should be scrolled vertically.

zoomFactor

A value between MinZoomFactor and MaxZoomFactor that specifies the required target ZoomFactor.

disableAnimation
System.Boolean System.Boolean System.Boolean

true to disable zoom/pan animations while changing the view; otherwise, false. The default is false.

Returns
bool bool bool

true if the view is changed; otherwise, false.

Attributes

Remarks

You can set parameter values to null to use this method to scroll only horizontally, only vertically, or to only change the zoom factor.

Examples

This code results in a ScrollViewer named myScrollViewer being scrolled to a horizontal offset of 2 without animation.

bool flag = myScrollViewer.ChangeView(2, null, null, true); 

GetBringIntoViewOnFocusChange(DependencyObject) GetBringIntoViewOnFocusChange(DependencyObject) GetBringIntoViewOnFocusChange(DependencyObject)

Gets the value of the BringIntoViewOnFocusChange dependency property / ScrollViewer.BringIntoViewOnFocusChange XAML attached property from a specified element.

public static bool GetBringIntoViewOnFocusChange(DependencyObject element)public static bool GetBringIntoViewOnFocusChange(DependencyObject element)Public Static Function GetBringIntoViewOnFocusChange(element As DependencyObject) As bool
Parameters
element
DependencyObject DependencyObject DependencyObject

The element from which the property value is read.

Returns
bool bool bool

The value of the property, as obtained from the property store.

Attributes

Remarks

For more info, see Remarks for the BringIntoViewOnFocusChange property.

GetHorizontalScrollBarVisibility(DependencyObject) GetHorizontalScrollBarVisibility(DependencyObject) GetHorizontalScrollBarVisibility(DependencyObject)

Gets the value of the HorizontalScrollBarVisibility dependency property / ScrollViewer.HorizontalScrollBarVisibility XAML attached property from a specified element.

public static ScrollBarVisibility GetHorizontalScrollBarVisibility(DependencyObject element)public static ScrollBarVisibility GetHorizontalScrollBarVisibility(DependencyObject element)Public Static Function GetHorizontalScrollBarVisibility(element As DependencyObject) As ScrollBarVisibility
Parameters
element
DependencyObject DependencyObject DependencyObject

The element from which the property value is read.

Returns

The value of the property, as obtained from the property store.

Attributes

Remarks

For more info, see Remarks for the HorizontalScrollBarVisibility property.

GetHorizontalScrollMode(DependencyObject) GetHorizontalScrollMode(DependencyObject) GetHorizontalScrollMode(DependencyObject)

Gets the value of the HorizontalScrollMode dependency property / ScrollViewer.HorizontalScrollMode XAML attached property from a specified element.

public static ScrollMode GetHorizontalScrollMode(DependencyObject element)public static ScrollMode GetHorizontalScrollMode(DependencyObject element)Public Static Function GetHorizontalScrollMode(element As DependencyObject) As ScrollMode
Parameters
element
DependencyObject DependencyObject DependencyObject

The element from which the property value is read.

Returns

The value of the property, as obtained from the property store.

Attributes

Remarks

For more info, see Remarks for the HorizontalScrollMode property.

GetIsDeferredScrollingEnabled(DependencyObject) GetIsDeferredScrollingEnabled(DependencyObject) GetIsDeferredScrollingEnabled(DependencyObject)

Gets the value of the IsDeferredScrollingEnabled dependency property / ScrollViewer.IsDeferredScrollingInertiaEnabled XAML attached property from a specified element.

public static bool GetIsDeferredScrollingEnabled(DependencyObject element)public static bool GetIsDeferredScrollingEnabled(DependencyObject element)Public Static Function GetIsDeferredScrollingEnabled(element As DependencyObject) As bool
Parameters
element
DependencyObject DependencyObject DependencyObject

The element from which the property value is read.

Returns
bool bool bool

The value of the property, as obtained from the property store.

Attributes

Remarks

For more info, see Remarks for the IsDeferredScrollingEnabled property.

GetIsHorizontalRailEnabled(DependencyObject) GetIsHorizontalRailEnabled(DependencyObject) GetIsHorizontalRailEnabled(DependencyObject)

Gets the value of the IsHorizontalRailEnabled dependency property / ScrollViewer.IsHorizontalRailEnabled XAML attached property from a specified element.

public static bool GetIsHorizontalRailEnabled(DependencyObject element)public static bool GetIsHorizontalRailEnabled(DependencyObject element)Public Static Function GetIsHorizontalRailEnabled(element As DependencyObject) As bool
Parameters
element
DependencyObject DependencyObject DependencyObject

The element from which the property value is read.

Returns
bool bool bool

The value of the property, as obtained from the property store.

Attributes

Remarks

For more info, see the IsHorizontalRailEnabled property.

GetIsHorizontalScrollChainingEnabled(DependencyObject) GetIsHorizontalScrollChainingEnabled(DependencyObject) GetIsHorizontalScrollChainingEnabled(DependencyObject)

Gets the value of the IsHorizontalScrollChainingEnabled dependency property / ScrollViewer.IsHorizontalScrollChainingEnabled XAML attached property from a specified element.

public static bool GetIsHorizontalScrollChainingEnabled(DependencyObject element)public static bool GetIsHorizontalScrollChainingEnabled(DependencyObject element)Public Static Function GetIsHorizontalScrollChainingEnabled(element As DependencyObject) As bool
Parameters
element
DependencyObject DependencyObject DependencyObject

The element from which the property value is read.

Returns
bool bool bool

The value of the property, as obtained from the property store.

Attributes

Remarks

For more info, see the IsHorizontalScrollChainingEnabled property.

GetIsScrollInertiaEnabled(DependencyObject) GetIsScrollInertiaEnabled(DependencyObject) GetIsScrollInertiaEnabled(DependencyObject)

Gets the value of the IsScrollInertiaEnabled dependency property / ScrollViewer.IsScrollInertiaEnabled XAML attached property from a specified element.

public static bool GetIsScrollInertiaEnabled(DependencyObject element)public static bool GetIsScrollInertiaEnabled(DependencyObject element)Public Static Function GetIsScrollInertiaEnabled(element As DependencyObject) As bool
Parameters
element
DependencyObject DependencyObject DependencyObject

The element from which the property value is read.

Returns
bool bool bool

The value of the property, as obtained from the property store.

Attributes

Remarks

For more info, see the IsScrollInertiaEnabled property.

GetIsVerticalRailEnabled(DependencyObject) GetIsVerticalRailEnabled(DependencyObject) GetIsVerticalRailEnabled(DependencyObject)

Gets the value of the IsVerticalRailEnabled dependency property / ScrollViewer.IsVerticalRailEnabled XAML attached property from a specified element.

public static bool GetIsVerticalRailEnabled(DependencyObject element)public static bool GetIsVerticalRailEnabled(DependencyObject element)Public Static Function GetIsVerticalRailEnabled(element As DependencyObject) As bool
Parameters
element
DependencyObject DependencyObject DependencyObject

The element from which the property value is read.

Returns
bool bool bool

The value of the property, as obtained from the property store.

Attributes

Remarks

For more info, see the IsVerticalRailEnabled property.

GetIsVerticalScrollChainingEnabled(DependencyObject) GetIsVerticalScrollChainingEnabled(DependencyObject) GetIsVerticalScrollChainingEnabled(DependencyObject)

Gets the value of the IsVerticalScrollChainingEnabled dependency property / ScrollViewer.IsVerticalScrollChainingEnabled XAML attached property from a specified element.

public static bool GetIsVerticalScrollChainingEnabled(DependencyObject element)public static bool GetIsVerticalScrollChainingEnabled(DependencyObject element)Public Static Function GetIsVerticalScrollChainingEnabled(element As DependencyObject) As bool
Parameters
element
DependencyObject DependencyObject DependencyObject

The element from which the property value is read.

Returns
bool bool bool

The value of the property, as obtained from the property store.

Attributes

Remarks

For more info, see the IsVerticalScrollChainingEnabled property.

GetIsZoomChainingEnabled(DependencyObject) GetIsZoomChainingEnabled(DependencyObject) GetIsZoomChainingEnabled(DependencyObject)

Gets the value of the IsZoomChainingEnabled dependency property / ScrollViewer.IsZoomChainingEnabled XAML attached property from a specified element.

public static bool GetIsZoomChainingEnabled(DependencyObject element)public static bool GetIsZoomChainingEnabled(DependencyObject element)Public Static Function GetIsZoomChainingEnabled(element As DependencyObject) As bool
Parameters
element
DependencyObject DependencyObject DependencyObject

The element from which the property value is read.

Returns
bool bool bool

The value of the property, as obtained from the property store.

Attributes

Remarks

For more info, see the IsZoomChainingEnabled property.

GetIsZoomInertiaEnabled(DependencyObject) GetIsZoomInertiaEnabled(DependencyObject) GetIsZoomInertiaEnabled(DependencyObject)

Gets the value of the IsZoomInertiaEnabled dependency property / ScrollViewer.IsZoomInertiaEnabled XAML attached property from a specified element.

public static bool GetIsZoomInertiaEnabled(DependencyObject element)public static bool GetIsZoomInertiaEnabled(DependencyObject element)Public Static Function GetIsZoomInertiaEnabled(element As DependencyObject) As bool
Parameters
element
DependencyObject DependencyObject DependencyObject

The element from which the property value is read.

Returns
bool bool bool

The value of the property, as obtained from the property store.

Attributes

Remarks

For more info, see the IsZoomInertiaEnabled property.

GetVerticalScrollBarVisibility(DependencyObject) GetVerticalScrollBarVisibility(DependencyObject) GetVerticalScrollBarVisibility(DependencyObject)

Gets the value of the VerticalScrollBarVisibility dependency property / ScrollViewer.VerticalScrollBarVisibility XAML attached property from a specified element.

public static ScrollBarVisibility GetVerticalScrollBarVisibility(DependencyObject element)public static ScrollBarVisibility GetVerticalScrollBarVisibility(DependencyObject element)Public Static Function GetVerticalScrollBarVisibility(element As DependencyObject) As ScrollBarVisibility
Parameters
element
DependencyObject DependencyObject DependencyObject

The element from which the property value is read.

Returns

The value of the property, as obtained from the property store.

Attributes

Remarks

For more info, see the VerticalScrollBarVisibility property.

GetVerticalScrollMode(DependencyObject) GetVerticalScrollMode(DependencyObject) GetVerticalScrollMode(DependencyObject)

Gets the value of the VerticalScrollMode dependency property / ScrollViewer.VerticalScrollMode XAML attached property from a specified element.

public static ScrollMode GetVerticalScrollMode(DependencyObject element)public static ScrollMode GetVerticalScrollMode(DependencyObject element)Public Static Function GetVerticalScrollMode(element As DependencyObject) As ScrollMode
Parameters
element
DependencyObject DependencyObject DependencyObject

The element from which the property value is read.

Returns

The value of the property, as obtained from the property store.

Attributes

Remarks

For more info, see the VerticalScrollMode property.

GetZoomMode(DependencyObject) GetZoomMode(DependencyObject) GetZoomMode(DependencyObject)

Gets the value of the ZoomMode dependency property / ScrollViewer.ZoomMode XAML attached property from a specified element.

public static ZoomMode GetZoomMode(DependencyObject element)public static ZoomMode GetZoomMode(DependencyObject element)Public Static Function GetZoomMode(element As DependencyObject) As ZoomMode
Parameters
element
DependencyObject DependencyObject DependencyObject

The element from which the property value is read.

Returns

The value of the property, as obtained from the property store.

Attributes

Remarks

For more info, see the ZoomMode property.

InvalidateScrollInfo() InvalidateScrollInfo() InvalidateScrollInfo()

Called when the value of properties that describe the size and location of the scroll area change.

public void InvalidateScrollInfo()public void InvalidateScrollInfo()Public Function InvalidateScrollInfo() As void
Attributes

ScrollToHorizontalOffset(Double) ScrollToHorizontalOffset(Double) ScrollToHorizontalOffset(Double)

Note

ScrollToHorizontalOffset may be altered or unavailable for releases after Windows 8.1. Instead, use ChangeView.

Scrolls the content that is within the ScrollViewer to the specified horizontal offset position.

public void ScrollToHorizontalOffset(Double offset)public void ScrollToHorizontalOffset(Double offset)Public Function ScrollToHorizontalOffset(offset As Double) As void
Parameters
offset
System.Double System.Double System.Double

The position that the content scrolls to.

Attributes

ScrollToVerticalOffset(Double) ScrollToVerticalOffset(Double) ScrollToVerticalOffset(Double)

Note

ScrollToVerticalOffset may be altered or unavailable for releases after Windows 8.1. Instead, use ChangeView.

Scrolls the content that is within the ScrollViewer to the specified vertical offset position.

public void ScrollToVerticalOffset(Double offset)public void ScrollToVerticalOffset(Double offset)Public Function ScrollToVerticalOffset(offset As Double) As void
Parameters
offset
System.Double System.Double System.Double

The position that the content scrolls to.

Attributes

SetBringIntoViewOnFocusChange(DependencyObject, Boolean) SetBringIntoViewOnFocusChange(DependencyObject, Boolean) SetBringIntoViewOnFocusChange(DependencyObject, Boolean)

Sets the value of the BringIntoViewOnFocusChange dependency property / ScrollViewer.BringIntoViewOnFocusChange XAML attached property on a specified element.

public static void SetBringIntoViewOnFocusChange(DependencyObject element, Boolean bringIntoViewOnFocusChange)public static void SetBringIntoViewOnFocusChange(DependencyObject element, Boolean bringIntoViewOnFocusChange)Public Static Function SetBringIntoViewOnFocusChange(element As DependencyObject, bringIntoViewOnFocusChange As Boolean) As void
Parameters
element
DependencyObject DependencyObject DependencyObject

The element on which to set the property value.

bringIntoViewOnFocusChange
System.Boolean System.Boolean System.Boolean

The value to set.

Attributes

Remarks

For more info, see Remarks for the BringIntoViewOnFocusChange property.

SetHorizontalScrollBarVisibility(DependencyObject, ScrollBarVisibility) SetHorizontalScrollBarVisibility(DependencyObject, ScrollBarVisibility) SetHorizontalScrollBarVisibility(DependencyObject, ScrollBarVisibility)

Sets the value of the HorizontalScrollBarVisibility dependency property / ScrollViewer.HorizontalScrollBarVisibility XAML attached property on a specified element.

public static void SetHorizontalScrollBarVisibility(DependencyObject element, ScrollBarVisibility horizontalScrollBarVisibility)public static void SetHorizontalScrollBarVisibility(DependencyObject element, ScrollBarVisibility horizontalScrollBarVisibility)Public Static Function SetHorizontalScrollBarVisibility(element As DependencyObject, horizontalScrollBarVisibility As ScrollBarVisibility) As void
Parameters
element
DependencyObject DependencyObject DependencyObject

The element on which to set the property value.

horizontalScrollBarVisibility
ScrollBarVisibility ScrollBarVisibility ScrollBarVisibility

The value to set.

Attributes

Remarks

For more info, see Remarks for the HorizontalScrollBarVisibility property.

SetHorizontalScrollMode(DependencyObject, ScrollMode) SetHorizontalScrollMode(DependencyObject, ScrollMode) SetHorizontalScrollMode(DependencyObject, ScrollMode)

Sets the value of the HorizontalScrollMode dependency property / ScrollViewer.HorizontalScrollMode XAML attached property on a specified element.

public static void SetHorizontalScrollMode(DependencyObject element, ScrollMode horizontalScrollMode)public static void SetHorizontalScrollMode(DependencyObject element, ScrollMode horizontalScrollMode)Public Static Function SetHorizontalScrollMode(element As DependencyObject, horizontalScrollMode As ScrollMode) As void
Parameters
element
DependencyObject DependencyObject DependencyObject

The element on which to set the property value.

horizontalScrollMode
ScrollMode ScrollMode ScrollMode

The value to set.

Attributes

Remarks

For more info, see Remarks for the HorizontalScrollMode property.

SetIsDeferredScrollingEnabled(DependencyObject, Boolean) SetIsDeferredScrollingEnabled(DependencyObject, Boolean) SetIsDeferredScrollingEnabled(DependencyObject, Boolean)

Sets the value of the IsDeferredScrollingEnabled dependency property / ScrollViewer.IsDeferredScrollingEnabled XAML attached property on a specified element.

public static void SetIsDeferredScrollingEnabled(DependencyObject element, Boolean isDeferredScrollingEnabled)public static void SetIsDeferredScrollingEnabled(DependencyObject element, Boolean isDeferredScrollingEnabled)Public Static Function SetIsDeferredScrollingEnabled(element As DependencyObject, isDeferredScrollingEnabled As Boolean) As void
Parameters
element
DependencyObject DependencyObject DependencyObject

The element on which to set the property value.

isDeferredScrollingEnabled
System.Boolean System.Boolean System.Boolean

The value to set.

Attributes

Remarks

For more info, see Remarks for the IsDeferredScrollingEnabled property.

SetIsHorizontalRailEnabled(DependencyObject, Boolean) SetIsHorizontalRailEnabled(DependencyObject, Boolean) SetIsHorizontalRailEnabled(DependencyObject, Boolean)

Sets the value of the IsHorizontalRailEnabled dependency property / ScrollViewer.IsHorizontalRailEnabled XAML attached property on a specified element.

public static void SetIsHorizontalRailEnabled(DependencyObject element, Boolean isHorizontalRailEnabled)public static void SetIsHorizontalRailEnabled(DependencyObject element, Boolean isHorizontalRailEnabled)Public Static Function SetIsHorizontalRailEnabled(element As DependencyObject, isHorizontalRailEnabled As Boolean) As void
Parameters
element
DependencyObject DependencyObject DependencyObject

The element on which to set the property value.

isHorizontalRailEnabled
System.Boolean System.Boolean System.Boolean

The value to set.

Attributes

Remarks

For more info, see the IsHorizontalRailEnabled property.

SetIsHorizontalScrollChainingEnabled(DependencyObject, Boolean) SetIsHorizontalScrollChainingEnabled(DependencyObject, Boolean) SetIsHorizontalScrollChainingEnabled(DependencyObject, Boolean)

Sets the value of the IsHorizontalScrollChainingEnabled dependency property / ScrollViewer.IsHorizontalScrollChainingEnabled XAML attached property on a specified element.

public static void SetIsHorizontalScrollChainingEnabled(DependencyObject element, Boolean isHorizontalScrollChainingEnabled)public static void SetIsHorizontalScrollChainingEnabled(DependencyObject element, Boolean isHorizontalScrollChainingEnabled)Public Static Function SetIsHorizontalScrollChainingEnabled(element As DependencyObject, isHorizontalScrollChainingEnabled As Boolean) As void
Parameters
element
DependencyObject DependencyObject DependencyObject

The element on which to set the property value.

isHorizontalScrollChainingEnabled
System.Boolean System.Boolean System.Boolean

The value to set.

Attributes

Remarks

For more info, see the IsHorizontalScrollChainingEnabled property.

SetIsScrollInertiaEnabled(DependencyObject, Boolean) SetIsScrollInertiaEnabled(DependencyObject, Boolean) SetIsScrollInertiaEnabled(DependencyObject, Boolean)

Sets the value of the IsScrollInertiaEnabled dependency property / ScrollViewer.IsScrollInertiaEnabled XAML attached property on a specified element.

public static void SetIsScrollInertiaEnabled(DependencyObject element, Boolean isScrollInertiaEnabled)public static void SetIsScrollInertiaEnabled(DependencyObject element, Boolean isScrollInertiaEnabled)Public Static Function SetIsScrollInertiaEnabled(element As DependencyObject, isScrollInertiaEnabled As Boolean) As void
Parameters
element
DependencyObject DependencyObject DependencyObject

The element on which to set the property value.

isScrollInertiaEnabled
System.Boolean System.Boolean System.Boolean

The value to set.

Attributes

Remarks

For more info, see the IsScrollInertiaEnabled property.

SetIsVerticalRailEnabled(DependencyObject, Boolean) SetIsVerticalRailEnabled(DependencyObject, Boolean) SetIsVerticalRailEnabled(DependencyObject, Boolean)

Sets the value of the IsVerticalRailEnabled dependency property / ScrollViewer.IsVerticalRailEnabled XAML attached property on a specified element.

public static void SetIsVerticalRailEnabled(DependencyObject element, Boolean isVerticalRailEnabled)public static void SetIsVerticalRailEnabled(DependencyObject element, Boolean isVerticalRailEnabled)Public Static Function SetIsVerticalRailEnabled(element As DependencyObject, isVerticalRailEnabled As Boolean) As void
Parameters
element
DependencyObject DependencyObject DependencyObject

The element on which to set the property value.

isVerticalRailEnabled
System.Boolean System.Boolean System.Boolean

The value to set.

Attributes

Remarks

For more info, see the IsVerticalRailEnabled property.

SetIsVerticalScrollChainingEnabled(DependencyObject, Boolean) SetIsVerticalScrollChainingEnabled(DependencyObject, Boolean) SetIsVerticalScrollChainingEnabled(DependencyObject, Boolean)

Sets the value of the IsVerticalScrollChainingEnabled dependency property / ScrollViewer.IsVerticalScrollChainingEnabled XAML attached property on a specified element.

public static void SetIsVerticalScrollChainingEnabled(DependencyObject element, Boolean isVerticalScrollChainingEnabled)public static void SetIsVerticalScrollChainingEnabled(DependencyObject element, Boolean isVerticalScrollChainingEnabled)Public Static Function SetIsVerticalScrollChainingEnabled(element As DependencyObject, isVerticalScrollChainingEnabled As Boolean) As void
Parameters
element
DependencyObject DependencyObject DependencyObject

The element on which to set the property value.

isVerticalScrollChainingEnabled
System.Boolean System.Boolean System.Boolean

The value to set.

Attributes

Remarks

For more info, see the IsVerticalScrollChainingEnabled property.

SetIsZoomChainingEnabled(DependencyObject, Boolean) SetIsZoomChainingEnabled(DependencyObject, Boolean) SetIsZoomChainingEnabled(DependencyObject, Boolean)

Sets the value of the IsZoomChainingEnabled dependency property / ScrollViewer.IsZoomChainingEnabled XAML attached property on a specified element.

public static void SetIsZoomChainingEnabled(DependencyObject element, Boolean isZoomChainingEnabled)public static void SetIsZoomChainingEnabled(DependencyObject element, Boolean isZoomChainingEnabled)Public Static Function SetIsZoomChainingEnabled(element As DependencyObject, isZoomChainingEnabled As Boolean) As void
Parameters
element
DependencyObject DependencyObject DependencyObject

The element on which to set the property value.

isZoomChainingEnabled
System.Boolean System.Boolean System.Boolean

The value to set.

Attributes

Remarks

For more info, see the IsZoomChainingEnabled property.

SetIsZoomInertiaEnabled(DependencyObject, Boolean) SetIsZoomInertiaEnabled(DependencyObject, Boolean) SetIsZoomInertiaEnabled(DependencyObject, Boolean)

Sets the value of the IsZoomInertiaEnabled dependency property / ScrollViewer.IsZoomInertiaEnabled XAML attached property on a specified element.

public static void SetIsZoomInertiaEnabled(DependencyObject element, Boolean isZoomInertiaEnabled)public static void SetIsZoomInertiaEnabled(DependencyObject element, Boolean isZoomInertiaEnabled)Public Static Function SetIsZoomInertiaEnabled(element As DependencyObject, isZoomInertiaEnabled As Boolean) As void
Parameters
element
DependencyObject DependencyObject DependencyObject

The element on which to set the property value.

isZoomInertiaEnabled
System.Boolean System.Boolean System.Boolean

The value to set.

Attributes

Remarks

For more info, see the IsZoomInertiaEnabled property.

SetVerticalScrollBarVisibility(DependencyObject, ScrollBarVisibility) SetVerticalScrollBarVisibility(DependencyObject, ScrollBarVisibility) SetVerticalScrollBarVisibility(DependencyObject, ScrollBarVisibility)

Sets the value of the VerticalScrollBarVisibility dependency property / ScrollViewer.VerticalScrollBarVisibility XAML attached property on a specified element.

public static void SetVerticalScrollBarVisibility(DependencyObject element, ScrollBarVisibility verticalScrollBarVisibility)public static void SetVerticalScrollBarVisibility(DependencyObject element, ScrollBarVisibility verticalScrollBarVisibility)Public Static Function SetVerticalScrollBarVisibility(element As DependencyObject, verticalScrollBarVisibility As ScrollBarVisibility) As void
Parameters
element
DependencyObject DependencyObject DependencyObject

The element on which to set the property value.

verticalScrollBarVisibility
ScrollBarVisibility ScrollBarVisibility ScrollBarVisibility

The value to set.

Attributes

Remarks

For more info, see the VerticalScrollBarVisibility property.

SetVerticalScrollMode(DependencyObject, ScrollMode) SetVerticalScrollMode(DependencyObject, ScrollMode) SetVerticalScrollMode(DependencyObject, ScrollMode)

Sets the value of the VerticalScrollMode dependency property / ScrollViewer.VerticalScrollMode XAML attached property on a specified element.

public static void SetVerticalScrollMode(DependencyObject element, ScrollMode verticalScrollMode)public static void SetVerticalScrollMode(DependencyObject element, ScrollMode verticalScrollMode)Public Static Function SetVerticalScrollMode(element As DependencyObject, verticalScrollMode As ScrollMode) As void
Parameters
element
DependencyObject DependencyObject DependencyObject

The element on which to set the property value.

verticalScrollMode
ScrollMode ScrollMode ScrollMode

The value to set.

Attributes

Remarks

For more info, see the VerticalScrollMode property.

SetZoomMode(DependencyObject, ZoomMode) SetZoomMode(DependencyObject, ZoomMode) SetZoomMode(DependencyObject, ZoomMode)

Sets the value of the ZoomMode dependency property / ScrollViewer.ZoomMode XAML attached property on a specified element.

public static void SetZoomMode(DependencyObject element, ZoomMode zoomMode)public static void SetZoomMode(DependencyObject element, ZoomMode zoomMode)Public Static Function SetZoomMode(element As DependencyObject, zoomMode As ZoomMode) As void
Parameters
element
DependencyObject DependencyObject DependencyObject

The element on which to set the property value.

zoomMode
ZoomMode ZoomMode ZoomMode

The value to set.

Attributes

Remarks

For more info, see the ZoomMode property.

ZoomToFactor(Single) ZoomToFactor(Single) ZoomToFactor(Single)

Note

ZoomToFactor may be altered or unavailable for releases after Windows 8.1. Instead, use ChangeView.

Sets the effective value of ZoomFactor.

public void ZoomToFactor(Single factor)public void ZoomToFactor(Single factor)Public Function ZoomToFactor(factor As Single) As void
Parameters
factor
System.Single System.Single System.Single

The zoom factor to set. The factors are based on a norm of 1.0, which represents no zoom applied. The values you can set are also influenced by current values for MinZoomFactor and MaxZoomFactor.

Attributes

Events

DirectManipulationCompleted DirectManipulationCompleted DirectManipulationCompleted

Occurs when any direct manipulation of the ScrollViewer finishes.

public event EventHandler DirectManipulationCompletedpublic event EventHandler DirectManipulationCompletedPublic Event DirectManipulationCompleted
Attributes

DirectManipulationStarted DirectManipulationStarted DirectManipulationStarted

Occurs when any direct manipulation of the ScrollViewer begins.

public event EventHandler DirectManipulationStartedpublic event EventHandler DirectManipulationStartedPublic Event DirectManipulationStarted
Attributes

ViewChanged ViewChanged ViewChanged

Occurs when manipulations such as scrolling and zooming have caused the view to change.

public event EventHandler ViewChangedpublic event EventHandler ViewChangedPublic Event ViewChanged
<ScrollViewer ViewChanged="eventhandler"/>
Attributes

Remarks

ViewChanging fires before ViewChanged.

In your event handler, use a parameter of type ScrollViewerViewChangedEventArgs for the second parameter of your handler method. ScrollViewerViewChangedEventArgs includes the IsIntermediate property, which reports whether the manipulation that fired the event is completed or still ongoing.

Not every underlying manipulation will necessarily fire this event. The class logic delays and consolidates intermediate events into a single occurrence in some cases.

ViewChanging ViewChanging ViewChanging

Occurs when manipulations such as scrolling and zooming cause the view to change.

public event EventHandler ViewChangingpublic event EventHandler ViewChangingPublic Event ViewChanging
<ScrollViewer ViewChanging="eventhandler"/>
Attributes

Remarks

ScrollViewerViewChangingEventArgs includes the IsInertial property, which reports whether the manipulation that is firing the event contains an inertial component.

Not every underlying manipulation will necessarily fire this event. The ScrollViewer logic delays and consolidates intermediate events into a single occurrence in some cases.

See Also