2011-06-13 20 views
3

我添加了一個網格控件(我添加了大約20行,每行包含2列,每個都有文本塊作爲子節點,我將RowHeight設置爲Auto)滾動查看器。它是滾動的,但沒有顯示網格的全部內容。可能是什麼原因?滾動查看器中的網格不工作

回答

2

問題在於框架無法確定要分配給控件的總高度。嘗試設置滾動查看器和/或網格的顯式高度(如果可以的話)。

更新 請張貼您的確切代碼。 (或者,至少代碼重現的問題。)

下面的代碼是我對你的所描述的內容的理解,但不創建您遇到

<Grid x:Name="LayoutRoot" Background="Transparent"> 
    <controls:Pivot Title="MY APPLICATION"> 
     <controls:PivotItem Header="first"> 
      <ScrollViewer> 
       <Grid> 
        <Grid.ColumnDefinitions> 
         <ColumnDefinition Width="*" /> 
         <ColumnDefinition Width="*" /> 
        </Grid.ColumnDefinitions> 
        <Grid.RowDefinitions> 
         <RowDefinition Height="Auto" /> 
         <RowDefinition Height="Auto" /> 
         <RowDefinition Height="Auto" /> 
         <RowDefinition Height="Auto" /> 
         <RowDefinition Height="Auto" /> 
         <RowDefinition Height="Auto" /> 
         <RowDefinition Height="Auto" /> 
         <RowDefinition Height="Auto" /> 
         <RowDefinition Height="Auto" /> 
         <RowDefinition Height="Auto" /> 
        </Grid.RowDefinitions> 

        <TextBlock Style="{StaticResource PhoneTextHugeStyle}" Text="A1" Grid.Column="0" Grid.Row="0" /> 
        <TextBlock Style="{StaticResource PhoneTextHugeStyle}" Text="A2" Grid.Column="1" Grid.Row="0" /> 
        <TextBlock Style="{StaticResource PhoneTextHugeStyle}" Text="B1" Grid.Column="0" Grid.Row="1" /> 
        <TextBlock Style="{StaticResource PhoneTextHugeStyle}" Text="B2" Grid.Column="1" Grid.Row="1" /> 
        <TextBlock Style="{StaticResource PhoneTextHugeStyle}" Text="C1" Grid.Column="0" Grid.Row="2" /> 
        <TextBlock Style="{StaticResource PhoneTextHugeStyle}" Text="C2" Grid.Column="1" Grid.Row="2" /> 
        <TextBlock Style="{StaticResource PhoneTextHugeStyle}" Text="D1" Grid.Column="0" Grid.Row="3" /> 
        <TextBlock Style="{StaticResource PhoneTextHugeStyle}" Text="D2" Grid.Column="1" Grid.Row="3" /> 
        <TextBlock Style="{StaticResource PhoneTextHugeStyle}" Text="E1" Grid.Column="0" Grid.Row="4" /> 
        <TextBlock Style="{StaticResource PhoneTextHugeStyle}" Text="E2" Grid.Column="1" Grid.Row="4" /> 
        <TextBlock Style="{StaticResource PhoneTextHugeStyle}" Text="F1" Grid.Column="0" Grid.Row="5" /> 
        <TextBlock Style="{StaticResource PhoneTextHugeStyle}" Text="F2" Grid.Column="1" Grid.Row="5" /> 
        <TextBlock Style="{StaticResource PhoneTextHugeStyle}" Text="G1" Grid.Column="0" Grid.Row="6" /> 
        <TextBlock Style="{StaticResource PhoneTextHugeStyle}" Text="G2" Grid.Column="1" Grid.Row="6" /> 
        <TextBlock Style="{StaticResource PhoneTextHugeStyle}" Text="H1" Grid.Column="0" Grid.Row="7" /> 
        <TextBlock Style="{StaticResource PhoneTextHugeStyle}" Text="H2" Grid.Column="1" Grid.Row="7" /> 
        <TextBlock Style="{StaticResource PhoneTextHugeStyle}" Text="I1" Grid.Column="0" Grid.Row="8" /> 
        <TextBlock Style="{StaticResource PhoneTextHugeStyle}" Text="I2" Grid.Column="1" Grid.Row="8" /> 
        <TextBlock Style="{StaticResource PhoneTextHugeStyle}" Text="J1" Grid.Column="0" Grid.Row="9" /> 
        <TextBlock Style="{StaticResource PhoneTextHugeStyle}" Text="J2" Grid.Column="1" Grid.Row="9" /> 
       </Grid> 
      </ScrollViewer> 
     </controls:PivotItem> 
    </controls:Pivot> 
</Grid> 
+0

我做以下stuff.i行爲在網格頂部添加全景圖片,併爲全景圖片添加全景圖,畫布我放在堆棧面板頂部,並且我將堆疊面板放在滾動視圖上,並且在網格上添加滾動視圖,此網格是全景圖的內容。它適用於全景,但與透視它不正確滾動。也爲我設置高度的每個畫布也可能是什麼問題。 – gusaindpk 2011-06-14 08:05:06

+0

@gusaindpk它可能會更容易,如果你顯示該代碼,而不是試圖解釋它 – 2011-06-14 08:17:34

+0

簡單地說,我正在使用網格添加文本塊,並將此網格添加到滾動視圖。並將網格設置爲數據項。但它不能正確滾動。當我在全景中做同樣的滾動工作正常。 – gusaindpk 2011-06-14 08:24:34