Prev | Current Page 255 | Next

Matthew MacDonald

"Pro WPF with VB 2008: Windows Presentation Foundation with .NET 3.5"

But first, it??™s worth taking a detour to consider a few more
sophisticated content controls: ScrollViewer, GroupBox, TabItem, and Expander. All of these
controls are designed to help you shape large portions of your user interface. However,
because these controls can only hold a single element, you??™ll usually use them in conjunction
with a layout container.
The ScrollViewer
In the previous chapter, you tried out several containers. However, none of them provided
support for scrolling, which is a key feature if you want to fit large amounts of content in a
limited amount of space. In WPF, scrolling support is easy to get, but it requires another
ingredient: the ScrollViewer content control.
CHAPTER 5 n CONTENT 125
In order to get scrolling support, you need to wrap the content you want to scroll inside
a ScrollViewer. Although the ScrollViewer can hold anything, you??™ll typically use it to wrap a
layout container. For example, in Chapter 4 you saw an example that used a Grid element to
create a three-column display of texts, text boxes, and buttons. To make this Grid scrollable,
you simply need to wrap the Grid in a ScrollViewer, as shown in this slightly shortened
markup:



...


.


Pages:
243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267