As already mentioned, the StackPanel
control does not automatically allow you to scroll its content. For this reason, when the screen is not big enough, some parts could just disappear. Of course, such a situation should not occur. For this reason, in this recipe, you will learn how to use ScrollViewer
to scroll the photo gallery created as a collection of images, presented in StackPanel
.
To arrange controls in a scrollable view to form a simple photo gallery, perform the following steps:
Add four images (named
Gallery1.jpg
,Gallery2.jpg
,Gallery3.jpg
, andGallery4.jpg
) to theAssets
directory, as explained in the Adding an image recipe.Modify the content of the
MainPage.xaml
file as follows:<Page (...)> <ScrollViewer Padding="10" ScrollViewer.VerticalScrollBarVisibility...