Free space within ListView containing another ListView

tschennietschennie USMember ✭✭

I have a ListView which also contains another ListView within its DataTemplate:

        <ContentPage.Content>
            <StackLayout>
                <ListView ItemsSource="{Binding Items}"
                          HasUnevenRows="true">
                    <ListView.ItemTemplate>
                        <DataTemplate>
                            <ViewCell>
                                <StackLayout Padding="10">
                                    <StackLayout Orientation="Horizontal">
                                        <Label Text="{Binding Test1}" 
                                               VerticalTextAlignment="Center"
                                               HorizontalOptions="FillAndExpand"
                                               FontSize="20"
                                               TextColor="{StaticResource PrimaryDark}"
                                               FontAttributes="Bold"/>

                                        <Label Text="No: " 
                                               VerticalTextAlignment="Center"
                                               FontSize="20" 
                                               TextColor="{StaticResource PrimaryDark}"/>

                                        <Label Text="{Binding No}" 
                                               VerticalTextAlignment="Center"
                                               FontSize="20" 
                                               TextColor="{StaticResource PrimaryDark}"/>
                                    </StackLayout>

                                    <ListView ItemsSource="{Binding Items}"
                                              HasUnevenRows="true" 
                                              SeparatorVisibility="None">
                                        <ListView.ItemTemplate>
                                            <DataTemplate>
                                                <ViewCell>
                                                    <StackLayout Padding="5">
                                                        <Label Text="{Binding Test2}"
                                                               FontSize="16" 
                                                               TextColor="{StaticResource LightTextColor}"/>
                                                    </StackLayout>
                                                </ViewCell>
                                            </DataTemplate>
                                        </ListView.ItemTemplate>
                                    </ListView>

                                </StackLayout>
                            </ViewCell>
                        </DataTemplate>
                    </ListView.ItemTemplate>
                </ListView>
            </StackLayout>
        </ContentPage.Content>

My models:

           public class Class1
           {
              public List<Class2> Items { get; set; }
           }

           public class Class2
           {
              public short No { get; set; }

              public string Test1 { get; set; }

              public List<Class3> Items { get; set; }
           }

           public class Class3
           {
              public string Test2 { get; set; }
           }

It looks quite good, but there is free space between the first item and the second one..

How can I remove this free space?

Tagged:

Best Answer

Answers

Sign In or Register to comment.