Files
docs-desktop/dotnet-desktop-guide/framework/wpf/controls/how-to-scroll-content-by-using-the-iscrollinfo-interface.md
T
Andy De George da363692ff Initial WPF content migrated (#17)
* Reset branch for WPF changes

* Convert BMP to PNG; fix link-out-of-scope err

* Add snippets for WPF... 6794 files!!!!

* Add missing snippets

* update file updated between migration

* Fix paths to include

* update breadcrumb and toc

* fix index links

* fix index links

* fix index links

* fix markdown
2020-09-04 09:46:28 -07:00

2.3 KiB

title, ms.date, dev_langs, helpviewer_keywords, ms.assetid
title ms.date dev_langs helpviewer_keywords ms.assetid
How to: Scroll Content by Using the IScrollInfo Interface 03/30/2017
csharp
vb
ScrollViewer control [WPF], scrolling content
scrolling content [WPF]
IScrollInfo interface [WPF]
d8700bef-a3f8-4c12-9de2-fc3b79f32cd3

How to: Scroll Content by Using the IScrollInfo Interface

This example shows how to scroll content by using the xref:System.Windows.Controls.Primitives.IScrollInfo interface.

Example

The following example demonstrates the features of the xref:System.Windows.Controls.Primitives.IScrollInfo interface. The example creates a xref:System.Windows.Controls.StackPanel element in [!INCLUDETLA#tla_xaml] that is nested in a parent xref:System.Windows.Controls.ScrollViewer. The child elements of the xref:System.Windows.Controls.StackPanel can be scrolled logically by using the methods defined by the xref:System.Windows.Controls.Primitives.IScrollInfo interface and cast to the instance of xref:System.Windows.Controls.StackPanel (sp1) in code.

[!code-xamlIScrollInfoMethods#2]

Each xref:System.Windows.Controls.Button in the [!INCLUDETLA2#tla_xaml] file triggers an associated custom method that controls scrolling behavior in xref:System.Windows.Controls.StackPanel. The following example shows how to use the xref:System.Windows.Controls.Primitives.IScrollInfo.LineUp%2A and xref:System.Windows.Controls.Primitives.IScrollInfo.LineDown%2A methods; it also generically shows how to use all the positioning methods that the xref:System.Windows.Controls.Primitives.IScrollInfo class defines.

[!code-csharpIScrollInfoMethods#3] [!code-vbIScrollInfoMethods#3]

See also