Reputation: 1110
I am working on a Xamarin.Forms PCL project.
I am working on a page that displays a post, the comments for that post, and an Entry to write a comment.
My XAML is
<ContentPage.Content>
<StackLayout>
<ScrollView>
<StackLayout>
<StackLayout>
<local:PostListView x:Name="Post" ItemTemplate=...>
</local:PostListView>
</StackLayout>
<StackLayout>
<Label x:Name="CommentHeader" FontSize="15" FontAttributes="Bold" HorizontalOptions="CenterAndExpand"/>
<ListView x:Name="CommentsList" HasUnevenRows="True" SeparatorVisibility="None">
<ListView.ItemTemplate>
<DataTemplate>
<local:PostViewCell>
...
</local:PostViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</StackLayout>
</ScrollView>
<StackLayout>
<StackLayout x:Name="CommentBox" Padding="10, 5, 10, 10">
<Entry x:Name="CommentEntry" Placeholder="Comment" BackgroundColor="GhostWhite" Focused="CommentEntry_Focused" Unfocused="CommentEntry_Unfocused" TextChanged="CommentEntry_TextChanged"/>
</StackLayout>
</StackLayout>
</StackLayout>
</ContentPage.Content>
The first custom ListView displays only a single post at a time but I use to so I can use the ItemTemplate feature.
My problems are:
The whole page should scroll together (leaving the comment entry) but the first ListView covers the whole screen and only shows the comment ListView once you scroll down, it only needs about 1/5 of the page the rest is blank white space.
The comment entry is supposed to sit on the bottom of the page but appear ontop the keyboard when focused but instead gets covered by the keyboard.
Upvotes: 1
Views: 1054
Reputation: 465
For The First point you can try Grid Instead Of Stack Layout to be able control the portion of each Container.
About the second Point I suggest you take a look at https://github.com/paulpatarinski/Xamarin.Forms.Plugins/tree/master/KeyboardOverlap
Upvotes: 1