Note that there are some explanatory texts on larger screens.

plurals
  1. POScrollViewer not working with StackPanel
    primarykey
    data
    text
    <p>Left side of my page I have a vertical StackPanel with the following elements:</p> <ul> <li>1 TextBlock</li> <li>1 vertical StackPanel with multiple elements that fills the available space</li> </ul> <p>I am trying to make the second <strong>StackPanel scrollable</strong> with a <strong>ScrollViewer</strong> element but with no success. If I define ScrollViewer Height to some value it works but I don't want to because I want it to fill all available vertical space.</p> <p>I am thinking to apply ScrollViewer Height in code reading StackPanel computed Height but this does not seem the right way of doing it. I tried also to bind <strong>Height</strong> and <strong>ActualHeight</strong> to StackPanel Height property but with no results.</p> <pre><code>&lt;ScrollViewer Grid.Row="1" VerticalAlignment="Top" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollMode="Enabled" ScrollViewer.HorizontalScrollMode="Disabled" ScrollViewer.ZoomMode="Disabled"&gt; &lt;StackPanel x:Name="sptest" Orientation="Vertical"&gt; &lt;TextBlock Style="{StaticResource PageHeaderTextStyle}"&gt;test1&lt;/TextBlock&gt; &lt;TextBlock Style="{StaticResource PageHeaderTextStyle}"&gt;test2&lt;/TextBlock&gt; &lt;TextBlock Style="{StaticResource PageHeaderTextStyle}"&gt;test3&lt;/TextBlock&gt; &lt;TextBlock Style="{StaticResource PageHeaderTextStyle}"&gt;test4&lt;/TextBlock&gt; &lt;TextBlock Style="{StaticResource PageHeaderTextStyle}"&gt;test5&lt;/TextBlock&gt; &lt;TextBlock Style="{StaticResource PageHeaderTextStyle}"&gt;test6&lt;/TextBlock&gt; &lt;TextBlock Style="{StaticResource PageHeaderTextStyle}"&gt;test7&lt;/TextBlock&gt; &lt;TextBlock Style="{StaticResource PageHeaderTextStyle}"&gt;test8&lt;/TextBlock&gt; &lt;TextBlock Style="{StaticResource PageHeaderTextStyle}"&gt;test9&lt;/TextBlock&gt; &lt;TextBlock Style="{StaticResource PageHeaderTextStyle}"&gt;test10&lt;/TextBlock&gt; &lt;TextBlock Style="{StaticResource PageHeaderTextStyle}"&gt;test11&lt;/TextBlock&gt; &lt;TextBlock Style="{StaticResource PageHeaderTextStyle}"&gt;test12&lt;/TextBlock&gt; &lt;/StackPanel&gt; &lt;/ScrollViewer&gt; </code></pre> <p>Beside I have also a GridView filling horizontal available space and it automatically have scrollbar. I did not define it and it apears when necessary. It is strange that StackPanel does not behave like I want. What am I doing wrong?</p> <p><strong>EDIT</strong></p> <p>I found this <a href="https://stackoverflow.com/questions/802821/how-can-i-get-scrollviewer-to-work-inside-a-stackpanel?rq=1">SO question</a>. It is about <strong>WPF</strong> and not WinRT but probably it is the same problem. It says:</p> <blockquote> <p>You can't without fixing the height of the StackPanel. It's designed to grow indefinitely in one direction. I'd advise using a different Panel</p> </blockquote> <p>I changed my StackPanel to a Grid (I didn't want to because of rows definitions since I only want one column) but ScrollViewer does not work either.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload