This topic has not yet been rated - Rate this topic

ScrollViewer.PageDown Method

Scrolls the ScrollViewer content downward by one page.

Namespace:  System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)
public void PageDown()

This method does not induce any scrolling behavior if ScrollInfo is null.

Logical scrolling is used to scroll to the next element in the logical tree. This differs from physical scrolling, which scrolls content by a defined physical increment in a given direction. If you require physical scrolling instead of logical scrolling, wrap the host Panel element in a ScrollViewer and set its CanContentScroll property to false.

This example shows how to use the scrolling methods of the ScrollViewer element. These methods provide incremental scrolling of content, either by line or by page, in a ScrollViewer.

The following example creates a ScrollViewer named sv1, which hosts a child TextBlock element. Because the TextBlock is larger than the parent ScrollViewer, scroll bars appear in order to enable scrolling. Button elements that represent the various scrolling methods are docked on the left in a separate StackPanel. Each Button in the XAML file calls a related custom method that controls scrolling behavior in ScrollViewer.


<StackPanel DockPanel.Dock="Left" Width="150">
  <Button Margin="3,0,0,2" Background="White" Click="svLineUp">Adjust Line Up</Button>
  <Button Margin="3,0,0,2" Background="White" Click="svLineDown">Adjust Line Down</Button>
  <Button Margin="3,0,0,2" Background="White" Click="svLineRight">Adjust Line Right</Button>
  <Button Margin="3,0,0,2" Background="White" Click="svLineLeft">Adjust Line Left</Button>
  <Button Margin="3,0,0,2" Background="White" Click="svPageUp">Adjust Page Up</Button>
  <Button Margin="3,0,0,2" Background="White" Click="svPageDown">Adjust Page Down</Button>
  <Button Margin="3,0,0,2" Background="White" Click="svPageRight">Adjust Page Right</Button>
  <Button Margin="3,0,0,2" Background="White" Click="svPageLeft">Adjust Page Left</Button>
  <TextBlock Name="txt2" TextWrapping="Wrap"/>
</StackPanel>

<Border BorderBrush="Black" Background="White" BorderThickness="2" Height="520" Width="520" VerticalAlignment="Top">
  <ScrollViewer VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Auto" Name="sv1">
    <TextBlock TextWrapping="Wrap" Width="800" Height="1000" Name="txt1"/> 
  </ScrollViewer>
</Border>


The following example uses the LineUp and LineDown methods.


private void svLineUp(object sender, RoutedEventArgs e)
{
    sv1.LineUp();
}
private void svLineDown(object sender, RoutedEventArgs e)
{
    sv1.LineDown();
}


.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.