Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

ListView space issue when HasUnevenRows=true. Need a solution.

$
0
0

Hi All,

I'm working on a simple listview structure. My requirement is basically to show elements in list. I want HasUnevenRows=true because few elements are single lined & few are multi lined.
Here is the code snippet I'm using.

<ListView ItemsSource="{Binding FireOrExplosionList}" HasUnevenRows="true" Grid.Row="2">
            <ListView.ItemTemplate>
              <DataTemplate>
              <ViewCell>
                <Label Text="{Binding Path=.}" TextColor="{StaticResource TextColor}" />
              </ViewCell>
              </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>

But here the problem is that I'm getting space in the list which is not required. You can see the below image where the space in marked in a rectangle.

Now If I'm changing the code to the following & removing the HasUnevenRows property then the space is not coming but rows in listview are not looking good as they are taking fixed height.

<ListView ItemsSource="{Binding FireOrExplosionList}" RowHeight="25" Grid.Row="2">
            <ListView.ItemTemplate>
              <DataTemplate>
              <ViewCell>
                <Label Text="{Binding Path=.}" TextColor="{StaticResource TextColor}" />
              </ViewCell>
              </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>

So my requirement is to enable HasUnevenRows property but get rid of the unwanted space.
Please provide a solution for this.

Thanks,
Priyabrata


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>