Scrolling

For most apps, the ability to scroll through content that is too large to view all at once is critical. XAML-based UI frameworks make this easy because all you need to do is wrap an element in a ScrollViewer control, and the element instantly becomes scrollable. ScrollViewer makes use of ScrollBar controls and hooks them up to your content automatically.

ScrollViewer has a Content property that can be set to a single item, typically an entire panel. Because Content is ScrollViewer’s content property in the XAML sense, you can place the item requiring scrolling as its child element. Here’s an example:

<Page ...>  <ScrollViewer>     <StackPanel>      ...    </StackPanel>  </ScrollViewer> </Page>

Figure 6.15 shows the Page containing the ...

Get XAML 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.