Match Frame height to its child height

MaticDiaMaticDia SIMember ✭✭

I would like to add three frames to my content page. Each frame would have a list view inside with different size of items. I would like to achieve that each frame would have height big enough to avoid scroll inside of a frame. Also I would like to avoid the last frame to expand all the way to the bottom of the page.

I was thinking of putting all three frames into a stack layout. The problem is that middle frame is always too small to match its child list so there user can scroll the frame. And the last frame always extends all the way to the bottom.

<StackLayout >
        <Frame HasShadow="True" Padding="1"  Margin="3" >
            <Label FontSize = "20" Text="Sample text" />
        </Frame>
        <Frame HasShadow="True" Padding="1" Margin="3" >
            <ListView  x:Name="FirstList"
                       SeparatorVisibility="Default"
                        GroupDisplayBinding="{Binding Name }"
                        GroupShortNameBinding="{Binding ShortName }"
                        IsGroupingEnabled="true"
                        Margin="3">           
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <TextCell Text="{Binding Title}"
                                Detail="{Binding Description }" />
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>
        </Frame>
        <Frame HasShadow="True" Padding="1" Margin="3" >
            <ListView  x:Name="SecondList"
                       SeparatorVisibility="Default"
                        GroupDisplayBinding="{Binding Name }"
                        GroupShortNameBinding="{Binding ShortName }"
                        IsGroupingEnabled="true"
                        Margin="3"> 
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <TextCell Text="{Binding Title}"
                                Detail="{Binding Description }" />
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>
        </Frame>
</StackLayout>

I was trying different Vertical options but was not successful.

Any tip would be more then helpful.

Tagged:

Answers

  • MarsgamesMarsgames FRMember ✭✭

    Have you try to put your StackLayout into a ScrollView ?

  • MaticDiaMaticDia SIMember ✭✭

    I have tried this. But then both of my ListViews are extended beyond its last item. Meaning, frames are much bigger then listviews.

Sign In or Register to comment.