Problem with ScrollViewer in WPF
I am having a problem with the scrollviewer on my WPF, where the scrollviewer doesn't a开发者_如何学运维llow me to scroll right to the bottom of the page, but only scrolls up or down to a given height. How do you make the scrollviewer in WPF scroll the whole page in a given visible screen area?
Simply answering your "how do you make it scroll the whole page?":
<ScrollViewer>
<!-- your content -->
</ScrollViewer>
Honest, there's no extra needed.
Here's a complete sample:
<Page Width="200" Height="200" Background="Yellow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ScrollViewer VerticalScrollBarVisibility="Visible"
HorizontalScrollBarVisibility="Visible">
<TextBlock VerticalAlignment="Center" HorizontalAlignment="Center">
The quick brown fox jumps over the lazy dog.
<LineBreak/>
The quick brown fox jumps over the lazy dog.
<LineBreak/>
The quick brown fox jumps over the lazy dog.
<LineBreak/>
The quick brown fox jumps over the lazy dog.
<LineBreak/>
The quick brown fox jumps over the lazy dog.
<LineBreak/>
The quick brown fox jumps over the lazy dog.
<LineBreak/>
The quick brown fox jumps over the lazy dog.
<LineBreak/>
The quick brown fox jumps over the lazy dog.
<LineBreak/>
The quick brown fox jumps over the lazy dog.
<LineBreak/>
The quick brown fox jumps over the lazy dog.
<LineBreak/>
The quick brown fox jumps over the lazy dog.
<LineBreak/>
The quick brown fox jumps over the lazy dog.
<LineBreak/>
The quick brown fox jumps over the lazy dog.
<LineBreak/>
The quick brown fox jumps over the lazy dog.
<LineBreak/>
The quick brown fox jumps over the lazy dog.
<LineBreak/>
The quick brown fox jumps over the lazy dog.
</TextBlock>
</ScrollViewer>
</Page>
精彩评论