* net-current-v30plus-md.md * net-current-v40plus-md.md * tla2sharptla-ui-md.md * tla2sharptla-uiautomation-md.md * tla2sharptla-winclient-md.md * tla2sharptla-xaml-md.md * tlasharptla-ui-md.md * tlasharptla-uiautomation-md.md * tlasharptla-winclient-md.md * tlasharptla-xaml-md.md * fix warnings
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 |
|
|
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 Extensible Application Markup Language (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 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]