Posts Tagged ‘ WP7. beginner ’

ScrollViewer not scrollable?

I am currently working on yet another application. In that application I have two pages, the MainPage where I can choose a certain phrase. Choosing one of them navigates me to my second page, where I have three TextBlocks. The length of the text varies, depending on the phrase I chose in the first page.

No problem, I thought. I’ll just put my TextBlocks in a StackPanel, And I nicely can put a ScrollViewer around the TextBlocks:

Well, what sounded nice in theory did not work out. When I ran the application, I could see there is a ScrollViewer, but somehow it just bounced back to the start point whenever I tried to scroll.

The solution was quite easy in the end. I replaced the StackPanel with a Grid:

Now I can scroll in the two TextBlocks that I need.

 

To be continued…

Addition: Yesterday I got this comment on this blog post:

“You limited the textbox height, but you wanted to limit the view of it.

So you could also set the height on the scrollviewer, and remove it (so it will be auto) on the textblocks. Let’s you still use the stackpanel. :)

Greets,

@David_TK”

So I tried that. And although I was happy with the solution I came up with, I like this solution as well. It just works:

Thank you @David_TK.

 

To be continued…

 

 

%d bloggers like this: