2017-04-06 3 views
0

Ich habe ein StackLayout, das ein TableView, ein Grid und ein paar Labels enthält.Wie vermeidet man TableView Scrollen auf XAML Forms?

Mein Problem ist, dass die StackLayout alle Elemente zwingen 100% der Höhe des Bildschirms zu bedecken, und es wird einen vertikalen Bildlauf auf meinem Tableview zu erzeugen:

enter image description here

Ich mag, dass entfernen vertikaler Bildlauf innerhalb des Steuerelements und stattdessen einen "globalen" Bildlauf für die gesamte Ansicht.

Das ist mein XAML-Code für diese Ansicht:

<?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

Beginnen Sie, indem Sie Ihrer Tabelle eine Höhe zuweisen – Jason

+0

Also, wenn ich eine neue soziale Netzwerkoption hinzufüge, muss ich diese Höhe aktualisieren? Gibt es einen dynamischeren Weg? – Multitut

Antwort

1

Warum gehst du nicht einfach einen anderen <TableSection/> hinzufügen, eine <ViewCell/> hinzufügen und fügen Sie, was in der Grid ist.

Hoffe es hilft!