Share via


ScrollViewer.ChangeView Method

Definition

Overloads

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.

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.

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.

[Windows.Foundation.Metadata.Overload("ChangeView")]
public bool ChangeView(System.Nullable<double> horizontalOffset, System.Nullable<double> verticalOffset, System.Nullable<float> zoomFactor);

Parameters

horizontalOffset

Nullable<Double>

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

verticalOffset

Nullable<Double>

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

zoomFactor

Nullable<Single>

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

Returns

Boolean

true if the view is changed; otherwise, false.

Attributes

Examples

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

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

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.

See also

Applies to

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.

[Windows.Foundation.Metadata.Overload("ChangeViewWithOptionalAnimation")]
public bool ChangeView(System.Nullable<double> horizontalOffset, System.Nullable<double> verticalOffset, System.Nullable<float> zoomFactor, bool disableAnimation);

Parameters

horizontalOffset

Nullable<Double>

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

verticalOffset

Nullable<Double>

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

zoomFactor

Nullable<Single>

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

disableAnimation
Boolean

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

Returns

Boolean

true if the view is changed; otherwise, false.

Attributes

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); 

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.

See also

Applies to