Prev | Current Page 257 | Next

Matthew MacDonald

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

On the other hand, if you use
Hidden you tell the content that it has an infinite amount of space. That means it can overflow and stretch
off into the scrollable region. Ordinarily, you??™ll only use Hidden if you plan to allow scrolling by another
mechanism (such as the custom scrolling buttons described next). You??™ll only use Disabled if you want to
temporarily prevent the ScrollViewer from doing anything at all.
The ScrollViewer also supports horizontal scrolling. However, the HorizontalScroll-
BarVisibility property is Hidden by default. To use horizontal scrolling, you need to change
this value to Visible or Auto.
Programmatic Scrolling
To scroll through the window in Figure 5-5, you can click the scroll bar with the mouse, you
can move over the grid and use a mouse scroll wheel, you can tab through the controls, or you
can click somewhere on the blank surface of the grid and use the up and down arrow keys. If
this still doesn??™t give you the flexibility you crave, you can use the methods of the ScrollViewer
class to scroll your content programmatically:
??? The most obvious are LineUp() and LineDown(), which are equivalent to clicking the
arrow buttons on the vertical scroll bar to move up or down once.
??? You can also use PageUp() and PageDown(), which scroll an entire screenful up or down
and are equivalent to clicking the surface of the scroll bar, above or below the scroll bar
thumb.


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