Skip to main content

Microsoft Silverlight

Answered Question ScrollViewer vs ScrollContentPresenter vs Scrollbar?RSS Feed

(0)

rmcsharry
rmcsharry

Member

Member

345 points

239 Posts

ScrollViewer vs ScrollContentPresenter vs Scrollbar?

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

--------------------------------------
If you can meet with triumph and disaster and treat those two imposters just the same...then you'll be a coder my son.

coughlinj
coughlinj

Member

Member

334 points

114 Posts

Re: ScrollViewer vs ScrollContentPresenter vs Scrollbar?

 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>

<ScrollViewer>

 

it is "MyControl" that will be scrolled.

rmcsharry
rmcsharry

Member

Member

345 points

239 Posts

Re: ScrollViewer vs ScrollContentPresenter vs Scrollbar?

OK, thanks, but then what's the difference between what you typed and this:

<ScrollBar>

 <src:MyControl>

<ScrollBar>

I understand the scrollviewer now (thanks) but not the scrollbar!?

Richard

--------------------------------------
If you can meet with triumph and disaster and treat those two imposters just the same...then you'll be a coder my son.

coughlinj
coughlinj

Member

Member

334 points

114 Posts

Answered Question

Re: ScrollViewer vs ScrollContentPresenter vs Scrollbar?

 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".

rmcsharry
rmcsharry

Member

Member

345 points

239 Posts

Re: ScrollViewer vs ScrollContentPresenter vs Scrollbar?

That's what I suspected, just wasn't sure. So thanks for answering!

--------------------------------------
If you can meet with triumph and disaster and treat those two imposters just the same...then you'll be a coder my son.
  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities