For those of you not familiar with Silverlight or the ScrollViewer control, we have just the thing for you. The ScrollViewer control for the Windows Phone 7 platform is a content control. What this means is that it is used to manage and organize other controls within it.

The only downfall to the ScrollViewer control is that it can only have one child control. This may seem like a hindrance, but there is a way to work around this. We can add a child control to our ScrollViewer that is also a content control, such as a StackPanel or Grid, which can contain multiple controls within them.

Let’s begin with today’s example by creating a new project. Now in our XAML file, let’s add a ScrollViewer control. We can also go ahead and set the HorizontalScrollBar and VerticalScrollBar to Auto. What this does is that lets say we enter a control within our ScrollViewer that we know we will need to scroll; the ScrollViewer will automatically determine the dimensions of the child control and set the scroll equal to it.

Now let’s add a StackPanel control to demonstrate this. Let’s also set the height and width of the StackPanel control as well to Auto. We now need something to put within our StackPanel control, I will be using TextBlock controls. Just add about 11 TextBlocks with a height of 50.

You can run the application now to see what the functionality is of the ScrollViewer control.

We can also do this with an Image control within the ScrollViewer. Create a second ScrollViewer control with an Image control as its child. We can then set the source to an image we add to our project, and then be sure to set the size of the Image control larger than that of the ScrollViewer to see how they work together.

And there you have it; this is the basic functionality of the ScrollViewer control. If you have any other questions or concerns and have not yet downloaded the source code for this project, I strongly suggest doing so. Seeing it in its entirety can help clear up many of your questions. Thank you for your time and I hope this has been helpful, take care.

Download Source Files