Forum Xamarin Xamarin.Forms

Why does my ViewCell's label text disappear at small row heights in Xamarin Forms?

I am trying to shrink the row size of a ListView in Xamarin that has so far been pretty reliable. The items look like this right now:

enter image description here

However, I now want to shrink them. I adjust the row height, and I get this:

enter image description here

What am I doing wrong? I have the property HasUnevenRows set to true, which seems to be what most questions advise. I have also read about bugs with the ListView on UWP: https://bugzilla.xamarin.com/show_bug.cgi?id=48428. But I'm developing for Android. Am I missing something fundamental here? Because this doesn't seem as intuitive as it should.

Here is my XAML:

                       <ListView 
                          ItemsSource="{Binding SummaryItems}"
                          VerticalOptions="StartAndExpand" 
                          HorizontalOptions="Fill"
                          RowHeight="50" 
                          BackgroundColor="LightGray" 
                          HasUnevenRows="True">
                        <ListView.ItemTemplate>
                            <DataTemplate>
                                <ViewCell >
                                    <Frame CornerRadius="2.5" Margin="0, 1" VerticalOptions="FillAndExpand">
                                        <Grid>
                                            <Grid.RowDefinitions>
                                                <RowDefinition Height="*" />
                                            </Grid.RowDefinitions>
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="*" />
                                                <ColumnDefinition Width="*" />
                                                <ColumnDefinition Width="*" />
                                                <ColumnDefinition Width="*" />
                                                <ColumnDefinition Width="*" />
                                            </Grid.ColumnDefinitions>
                                            <Label Grid.Column="0" VerticalOptions="Center" HorizontalOptions="Center" Text="test"  />
                                            <Label Grid.Column="1" VerticalTextAlignment="Center" HorizontalTextAlignment="Center" Text="{Binding Item2}"  />
                                            <Label Grid.Column="2" HorizontalTextAlignment="Center" Text="{Binding Item3}"  />
                                            <Label Grid.Column="3" HorizontalTextAlignment="Center" Text="{Binding Item4}"  />
                                            <Label Grid.Column="4" HorizontalTextAlignment="Center" Text="{Binding Item5}"  />
                                        </Grid>
                                    </Frame>
                                </ViewCell>
                            </DataTemplate>
                        </ListView.ItemTemplate>
                    </ListView>

Best Answer

Answers

Sign In or Register to comment.