2017-04-06 54 views
0

我有一個StackLayout,其中包含一個TableView,一個網格和一對夫婦的標籤。如何避免XAML表單上的TableView滾動?

我的問題是,StackLayout強制所有元素,包括屏幕高度的100%,而這也帶來我的TableView垂直滾動:

enter image description here

我想刪除垂直滾動控件,而是爲整個視圖設置一個「全局」滾動條。

這是我對這一觀點XAML代碼:

<?xml version="1.0" encoding="UTF-8"?> 
<ContentPage Title="Create Account" 
    xmlns="http://xamarin.com/schemas/2014/forms" 
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
    xmlns:local="clr-namespace:AudioBitts" 
    x:Class="AudioBitts.SignUpPage"> 
    <StackLayout> 
     <TableView x:Name="socialListView"> 
      <TableRoot> 
       <TableSection Title="Social sign up"> 
        <ImageCell ImageSource="{local:EmbeddedImage [email protected]}" Text="Sign up with Facebook" /> 
        <ImageCell ImageSource="{local:EmbeddedImage [email protected]}" Text="Sign up with Twitter" /> 
        <ImageCell ImageSource="{local:EmbeddedImage [email protected]}" Text="Sign up with Google+" /> 
       </TableSection> 
       <TableSection Title="Email sign up"> 
        <EntryCell Label="Email" Placeholder="Your email"/> 
        <EntryCell Label="Password" Placeholder="Min 6 characters"/> 
       </TableSection> 
      </TableRoot> 
     </TableView> 
     <Grid Padding="20" HorizontalOptions="Center" VerticalOptions="Center"> 
      <Grid.RowDefinitions> 
       <RowDefinition Height="40" /> 
      </Grid.RowDefinitions> 
      <Grid.ColumnDefinitions> 
       <ColumnDefinition Width="Auto" /> 
       <ColumnDefinition Width="Auto" /> 
      </Grid.ColumnDefinitions> 
      <Label Grid.Row="0" Grid.Column="0" Text="Already have an account?" /> 
      <Label x:Name="onSignIn" Grid.Row="0" Grid.Column="1" Text="Sign In" TextColor="#ff0030" /> 
     </Grid> 
     <Label Text="AudioBitts Inc." HorizontalOptions="Center" /> 
     <Label Text="Terms of Use and Privacy Policy" HorizontalOptions="Center" /> 
    </StackLayout> 
</ContentPage> 
+0

首先給表格分配一個高度 – Jason

+0

因此,如果我添加一個新的社交網絡選項,我需要更新該高度?有沒有更具活力的方式? – Multitut

回答

1

你爲什麼不添加另一<TableSection/>,添加一個<ViewCell/>並添加有什麼Grid內。

希望它有幫助!