I have a list view with a template switcher, and a on a particular item I want it to be hidden so I've used a hidden template. I set the view (or the StackLayout) to be isVisible=false and the HeightRequest=0 so that it should not take up space and should not be visible. However as you can see in the picture, it is still taking up an empty space.
In the image below, there are 2 hidden messages. The one before the "This is a Bot Hero Card Message!" and the one after it.
How do you do this to make it not take up space?
Please use Grid in your listview. It will solve your issue. for more info https://forums.xamarin.com/discussion/83632/hiding-and-showing-stacklayout
<ListView x:Name="ItemList" HasUnevenRows="True">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell Appearing="Cell_OnAppearing" Tapped="ViewCell_Tapped" >
<ViewCell.View>
<Grid.RowDefinitions>
<RowDefinition Height="100"/>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
</ViewCell.View>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
thanks
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With