Scrolling the Visual Tree with the ScrollViewer Control

The ScrollViewer element enables scrolling its entire content with both horizontal and vertical scrollbars. This can be easily understood directly at design time. Type the following XAML code:

<ScrollViewer VerticalScrollBarVisibility="Auto"              HorizontalScrollBarVisibility="Auto">    <StackPanel>        <TextBlock Width="1000"/>        <TextBlock Height="2000"/>    </StackPanel></ScrollViewer>

You notice that, because of the big width and height values, the ScrollViewer provides both scrollbars, as demonstrated in Figure 29.17.

Image

FIGURE 29.17 Implementing ...

Get Visual Basic 2015 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.