Dan
Dan

Reputation: 1110

ListView taking more height than needed and Entry being hidden

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:

Upvotes: 1

Views: 1054

Answers (1)

Ahmed Sayed
Ahmed Sayed

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

Related Questions