2016-11-17 69 views
0

我正嘗試建立一個UWP應用程序,我有後續的組件內:UWP的ScrollViewer一個SplitView.Content不滾動

的MainPage:

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> 

    <Grid.RowDefinitions> 
     <RowDefinition Height="50"/> 
     <RowDefinition Height="Auto"/> 
     <RowDefinition Height="*"/> 
    </Grid.RowDefinitions> 

    <StackPanel Name="TituloStackPanel" Orientation="Horizontal"> 
     <Button Name="HamburguerButton" Content="&#xE700;" FontFamily="Segoe MDL2 Assets" Height="50" Width="50" Click="HamburguerButton_Click"/> 
     <TextBlock Name="Titulo" Text="Estrutura de Dados" VerticalAlignment="Center" Margin="10"/> 
    </StackPanel> 

    <SplitView Name="PrincipalSplitView" DisplayMode="CompactOverlay" IsPaneOpen="False" 
       CompactPaneLength="50" OpenPaneLength="200" Grid.Row="1"> 
     <SplitView.Pane> 
      <StackPanel> 
       <StackPanel Orientation="Horizontal"> 
        <Button Name="ListasButton" Content="L" Width="50" Height="50" Click="ListasButton_Click"/> 
        <TextBlock Text="Listas" VerticalAlignment="Center" Margin="10"/> 
       </StackPanel> 
       <StackPanel Orientation="Horizontal"> 
        <Button Name="PilhasButton" Content="P" Width="50" Height="50"/> 
        <TextBlock Text="Pilhas" VerticalAlignment="Center" Margin="10"/> 
       </StackPanel> 
       <StackPanel Orientation="Horizontal"> 
        <Button Name="FilasButton" Content="F" Width="50" Height="50"/> 
        <TextBlock Text="Filas" VerticalAlignment="Center" Margin="10"/> 
       </StackPanel> 
      </StackPanel> 
     </SplitView.Pane> 
     <SplitView.Content> 
      <TextBlock Text="SplitView Content" VerticalAlignment="Center" HorizontalAlignment="Center"/> 
     </SplitView.Content> 
    </SplitView> 
</Grid> 

下一頁將裏面的內容被加載的SplitView。

<Page> 
    <Grid> 

    <Grid.ColumnDefinitions> 
    <ColumnDefinition Width="*"/> 
    <ColumnDefinition Width="200"/> 
    </Grid.ColumnDefinitions> 

    <ScrollViewer Background="Cyan" Grid.Column="1" VerticalScrollBarVisibility="Auto"> 
     <RelativePanel Padding="20" MaxHeight="700" VerticalAlignment="Top"> 
     <A lot of Components: TextBlocks, TextBoxes, RadioButtons, ... /> 
     </RelativePanel> 
    </ScrollViewer> 
    </Grid> 
</Page> 

ScrollViewer應該作爲窗口右側的工具欄。但是當我調整窗口大小時,垂直滾動不起作用。

全屏: Page in full screen

調整大小: Page resized

+0

RelativeLayout是一個自定義控件嗎?它是爲了什麼? –

+0

您是否調整了足夠大的窗口大小,以便不需要滾動條。 –

+0

@ Sunteen-MSFT,但是當我調整窗口大小時,滾動不起作用。 –

回答

1

的問題是因爲你的SPLITVIEW是與<RowDefinition Height="Auto"/>的行。這使得SplitView高於屏幕並且不會因此而滾動。
對此行使用<RowDefinition Height="*"/>以使其與屏幕一樣高。

<Grid.RowDefinitions> 
     <RowDefinition Height="50"/> 
     <RowDefinition Height="*"/> 
</Grid.RowDefinitions> 

<SplitView Grid.Row="1"> 
    .... 
</SpitView>