Prev | Current Page 259 | Next

Matthew MacDonald

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

CanContentScroll property to True.
??? When you interact with the ScrollViewer (by using the scroll bar, the mouse wheel, the
scrolling methods, and so on), the ScrollViewer calls the appropriate methods on your
element using the IScrollInfo interface. The element then performs its own custom
scrolling.
nNote The IScrollInfo defines a set of methods that react to different scrolling actions. For example, it
includes many of the scrolling methods exposed by the ScrollViewer, such as LineUp(), LineDown(), PageUp(),
and PageDown(). It also defines methods that handle the mouse wheel.
Very few elements implement IScrollInfo. One element that does is the StackPanel container.
Its implementation of IScrollInfo implements logical scrolling, scrolling that moves
from element to element rather than from line to line.
If you place a StackPanel in a ScrollViewer and you don??™t set the CanContentScroll property,
you get the ordinary behavior. Scrolling up and down moves you a few pixels at a time.
However, if you set CanContentScroll to True, each time you click down you scroll to the
beginning of the next element:
CHAPTER 5 n CONTENT 128








You may or may not find that the StackPanel??™s logical scrolling system is useful in your
application.


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