2017-04-06 50 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内。

希望它有帮助!