Skip to main content
Home Forums Silverlight Programming Silverlight Controls and Silverlight Toolkit ScrollViewer vs ScrollContentPresenter vs Scrollbar?
4 replies. Latest Post by rmcsharry on September 26, 2008.
(0)
rmcsharry
Member
345 points
239 Posts
09-26-2008 2:57 PM |
Hi,
Can anyone tell me the difference between these? Is the ScrollViewer simply a combination of the ScrollContentPresenter and the Scrollbar?
And if you drop a scrollbar into your code (or onto Blend design surface) how do you tell it what it is meant to be scrolling?
Thanks,
Richard
coughlinj
334 points
114 Posts
09-26-2008 3:10 PM |
Richard you more or less answered your own question. If you examine a ScrollViewer's default template you'll see it consists of just a ScrollViewer and 2 Scrollbars.
Check out http://msdn.microsoft.com/en-us/library/cc278065(VS.95).aspx for more information.
It is the "Content" of the scroll bar that is scrolled.
For example
<ScrollViewer>
<src:MyControl>
it is "MyControl" that will be scrolled.
09-26-2008 3:58 PM |
OK, thanks, but then what's the difference between what you typed and this:
<ScrollBar>
I understand the scrollviewer now (thanks) but not the scrollbar!?
09-26-2008 4:14 PM |
What you've posted their does not make sense ScrollBar is not a ContentControl and thus should not work (ie. it should break when you run). A ScrollBar is just the visual control used that displays the Up Arrow, ThumbPiece and Down Arrow. It does not support "Content".
The ScrollViewer is the Control you want to use. You want to set its "Content".
09-26-2008 4:19 PM |
That's what I suspected, just wasn't sure. So thanks for answering!