Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Silverlight Vertical only ScrollViewer?

Is there a way to create a ScrollViewer which only allows content to scroll vertically? The horizontal (width) must be constrained in the same manner as a StackPanel's width is constrained to its parent (when HorizontalAlignment=Stretch).

I have a resizable window which contains content I want to allow to scroll vertically. The window contains a ScrollViewer. Inside there is a lot of TextBoxs (a data entry form). When I type lots of text in a TextBox, the control just keeps growing to the right, and off the window. If I use a StackPanel instead of a ScrollViewer, then the size of the TextBox remains the same no matter how much text is in there. (but then no vertical scrolling).

I cant set a hard-coded Width because the window is resizable.

So basically I want to constrain the ScrollViewer from growing in the Horizontal direction.

Thanks

like image 544
Matt Avatar asked Oct 07 '11 01:10

Matt


1 Answers

Try setting

<ScrollViewer HorizontalScrollBarVisibility="Disabled">
like image 184
Justin XL Avatar answered Oct 19 '22 01:10

Justin XL