2016-03-09 98 views
3

將這個表格展開時,我需要一個包含其內容大小的頁眉,包含內容大小的頁眉,以及一個展開其餘內容的中間頁面。輕鬆使用XAML/UWP。但在Xamarin表單中,當ScrollView內容有數據時,它將浮動並覆蓋頂部和底部。另外,當我拖動/滾動ScrollView時,它可以進入屏幕的頂部。如何正確停靠scrollview,所以我有一個滾動中間區域? THX ...Scrollview在滾動時全面滾動其他內容

圖片及以下XAML佈局....

enter image description here

enter image description here

<?xml version="1.0" encoding="utf-8" ?> 
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" 
     xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
     x:Class="BaseProject.MainPage"> 
<Label Text="{Binding MainText}" VerticalOptions="Center" HorizontalOptions="Center" /> 
<Grid> 
<Grid.RowDefinitions> 
    <RowDefinition Height="Auto"/> 
    <RowDefinition Height="*"/> 
    <RowDefinition Height="Auto"/> 
</Grid.RowDefinitions> 
<TableView Grid.Row="0" Intent="Settings" BackgroundColor="Blue" HeightRequest="150" > 
    <TableSection Title="Search"> 
    <ViewCell> 
     <Button x:Name="Button_Search" Text="Go"/> 
    </ViewCell> 
    <EntryCell x:Name="Entry_Cell_SearchFor" /> 
    </TableSection> 
</TableView> 
<ScrollView Grid.Row="1" VerticalOptions="FillAndExpand" Orientation="Vertical"> 
    <StackLayout BackgroundColor="Red" > 
    <Label Text="body" x:Name="Label_Body" BackgroundColor="Yellow" /> 
    </StackLayout> 
</ScrollView> 
    <StackLayout Grid.Row="2"> 
    <Label Text="footer"/> 
    </StackLayout> 
    </Grid> 
</ContentPage> 
+0

我想你的樣品XAML和它的行爲如預期。你在真實應用中使用了什麼ScrollView內容?我只是在ScrollView的StackLayout中添加了一堆更多的標籤來強制它溢出,並且它不會越過中心「body」區域的邊界。 –

+0

我正在運行舊的xam表單。我升級到最新版本,現在它運行良好。謝謝Keith,如果你想發佈一個答案,我會標記它。 –

回答

6

設置IsClippedToBounds財產trueScrollView