The ScrollViewer Control

The ScrollViewer control allows you to easily define a view port, which can contain large content areas.
The ScrollViewer supports horizontal and vertical scrollbars, which can be used to move over the content.

Typically, the Content property of the ScrollViewer will be a nested panel system of items. However, you
could simply place a single (large) UI element as content. For example, notice how much larger the Ellipse is
than the ScrollViewer control. Because we have configured vertical and horizontal scrollbars, the view port
adjusts automatically.


<UserControl x:Class="SL_Controls.Page"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  Width="400" Height="300">
  <Grid x:Name="LayoutRoot" Background="White">
      <ScrollViewer Height="100" Width="300"
                    VerticalScrollBarVisibility="Auto"
                    HorizontalScrollBarVisibility="Auto">
          <Ellipse Fill="Red" Height="900" Width="900"/>
      </ScrollViewer>
  </Grid>
</UserControl>


















At this point you have surveyed numerous Silverlight controls and layout options. In your next lab, you will
build on this foundation by learning how to intercept control wide mouse and keyboard input. You will learn
to implement drag-and-drop behaviors into your Silverlight plug-in. Later labs in the class will have you work
with controls not covered in this chapter, such as the DataGrid and the MediaElement.
ScrollViewer Control
Table of Contents
Copyright (c) 2008.  Intertech, Inc. All Rights Reserved.  This information is to be used exclusively as an
online learning aid.  Any attempts to copy, reproduce, or use for training is strictly prohibited.
Courseware
Training Resources
Tutorials
Services