Prev | Current Page 256 | Next

Matthew MacDonald

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

..


Height="Auto" VerticalAlignment="Center">

...


The result is shown in Figure 5-5.
Figure 5-5. A scrollable window
CHAPTER 5 n CONTENT 126
If you resize the window in this example so that it??™s large enough to fit all its content, the
scroll bar becomes disabled. However, the scroll bar will still be visible. You can control this
behavior by setting the VerticalScrollBarVisibility property, which takes a value from the
ScrollBarVisibility enumeration. The default value of Visible makes sure the vertical scroll bar
is always present. Use Auto if you want the scroll bar to appear when it??™s needed and disappear
when it??™s not. Or use Disabled if you don??™t want the scroll bar to appear at all.
nNote You can also use Hidden, which is similar to Disabled but subtly different. First, content with a
hidden scroll bar is still scrollable. (For example, you can scroll through the content using the arrow keys.)
Second, the content in a ScrollViewer is laid out differently. When you use Disabled, you tell the content in
the ScrollViewer that it has only as much space as the ScrollViewer itself.


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