2012-08-28 87 views
0

我已經在WinRT/Metro中創建了以下頁面,並且希望從ScrollViewer中獲得水平和垂直滾動條,因爲內容區域在兩個維度中都大於屏幕和ScrollViewer。任何人都可以發現任何錯誤嗎?這個ScrollViewer爲什麼不產生水平滾動條?

<Page 
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
xmlns:local="using:Test" 
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
x:Class="ScrollViewerTestPage" 
mc:Ignorable="d">  

<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}"> 
    <ScrollViewer> 
     <ItemsControl ItemsSource="{Binding}" Width="2500" > 
      <ItemsControl.ItemsPanel> 
       <ItemsPanelTemplate> 
        <StackPanel Orientation="Horizontal"/> 
       </ItemsPanelTemplate> 
      </ItemsControl.ItemsPanel> 
      <ItemsControl.ItemTemplate> 
       <DataTemplate> 
        <TextBox Width="100" Margin="5" Height="1200" Text="{Binding}"/> 
       </DataTemplate> 
      </ItemsControl.ItemTemplate> 
     </ItemsControl> 
    </ScrollViewer>  
</Grid> 
</Page> 

的數據是在構造函數初始化這樣的:

var model = new List<string>(); 
for (int i = 1; i <= 20; i++) model.Add("" + i); 
DataContext = model; 

回答