There are occasions when some data to display is larger than the display area; this requires scrolling capabilities. WPF provides that using a simple control, the
Make sure Visual Studio is up and running.
We'll create a simple image viewer that provides scrollbars if necessary when viewing a large image:
Penguins.jpgfile from the Pictures | Sample Pictures folder.
MainWindow.xaml. Add a
ScrollViewercontrol inside the existing
ScrollViewer, add an
Imageelement, and set its
Sourceproperty to the image you added:
<ScrollViewer> <Image ...