WPF中的ScrollViewer问题

时间:2011-07-06 20:12:44

标签: wpf scrollviewer

我的WPF上的scrollviewer出现问题,其中scrollviewer不允许我向右滚动到页面底部,但只能向上或向下滚动到给定的高度。如何使WPF中的滚动查看器在给定的可见屏幕区域中滚动整个页面?

1 个答案:

答案 0 :(得分:0)

简单回答你的“如何让它滚动整页?”:

<ScrollViewer>
    <!-- your content -->
</ScrollViewer>

诚实,没有额外的需要。

这是一个完整的样本:

<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>

enter image description here