2011-07-06 53 views
0

我在我的WPF上滾動查看器出現問題,滾動查看器不允許我向右滾動到頁面底部,但只能向上或向下滾動到給定高度。你如何使WPF中的滾動查看器在給定的可見屏幕區域滾動整個頁面?WPF中的滾動查看器的問題

+1

您可以發佈您的XAML?這對幫助你非常有用。謝謝! –

+0

我沒有在我身上,因爲它在工作。明天早上將發佈相關代碼片段 – Andy5

回答

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

+0

這沒有奏效。滾動條仍然沒有給出選項來達到頁面的左右。代碼片段是 Andy5

+0

我看到你的評論@ Andy5,所以我用一個完整的例子更新了我的答案。我保證它的工作。我只是在Kaxaml中測試它。 –

+0

有時候,@ Andy5,當我遇到你所描述的問題時,我把東西換成了,這是因爲某些原因,控件佔據了所有可用空間的最大成功。 –