Set ScrollViewer Height With Screen Height In Windows Phone

Frankly, this gave me a ton of a headache. I thought when using the Grid container’s RowDefinition attribute’s height to auto, it will set the height according to the screen’s height.

As I found out, it does not. What happened was that I placed component after component and the Grid‘s height kept on expanding to the point that its height went beyond that of the screen’s overall height.

Naturally, I attached a ScrollViewer so that I could scroll down to see the other contents but what happened was that once I released my finger upon scrolling down, it snapped back to its original position (top).

I read in forums that setting the ScrollViewer height should do the trick but that even that is not a viable solution since who knows in the future Microsoft may have smart phones with different screen size.

My XAML looks like this. Grid > Grid > ScrollViewer > contents.

Now, the solution is not really to place any static height within the ScrollViewer but to make sure that your root Grid has a height value of its RowDefinition to * and not auto.

See example.

Now you can scroll to the bottom most part of the ScrollViewer.

Donations appreciated. Every little $ helps. Or click Google +1.

Related Posts Plugin for WordPress, Blogger...
  1. 6 Responses to “Set ScrollViewer Height With Screen Height In Windows Phone”

  2. Very interesting your posting, thanks for putting up.

    By placenta injection on Mar 19, 2012

  3. This is a great blog posting and very useful. I really appreciate the research you put into it.Superb!

    By cara merawat wajah on May 1, 2012

  4. I like this website, Thanks for sharing this information. Keep posting more.

    By jasa pembuatan sim dan perpanjangan stnk on Oct 2, 2012

  5. I very happy to find this website on bing, just what I was looking for : D also bookmarked

    By toko herbal on Oct 20, 2012

  6. This should be on top of google search results Thanks a lot !! :)

    By Saurabh on Oct 26, 2012

  7. nice article guys…..

    By jasa pembuatan sim dan perpanjangan stnk on Dec 25, 2012

Post a Comment