开发者

Problem with ScrollViewer in WPF

开发者 https://www.devze.com 2023-03-18 07:18 出处:网络
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 heigh

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>

Problem with ScrollViewer in WPF

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号