I need the items in my listView to have a height so it the list exactly fits the screen. Here's my code given below. I tried setting the Height of rows in my grid to a custom value, but that would work well, fitting the screen in some devices, while there would be an empty space in other devices due to a different screen size.
<ListView
ItemsSource="{Binding PenStocks}"
ItemSelected="Event_ItemSelected"
ItemTapped="Event_ItemTapped"
SeparatorVisibility="None"
Margin="5,5,5,0"
>
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Grid Padding="9" ColumnSpacing="0" RowSpacing="0" HorizontalOptions="FillAndExpand" >
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.408*"/>
<ColumnDefinition Width="0.051*"/>
<ColumnDefinition Width="0.252*"/>
<ColumnDefinition Width="0.033*"/>
<ColumnDefinition Width="0.153*"/>
<ColumnDefinition Width="0.102*"/>
</Grid.ColumnDefinitions>
What can I do for this? Please help me and thank you!
CodePudding user response:
If you want to your listViewItem to stretch to the height of it's inner control you can use
<RowDefinition Height="Auto"/>
It would be better if you share some screen shots.
Or you can check out the below post:
RowDefinition Height not working when using bound property on Grid in ListView?
CodePudding user response:
I tried using an absolutelayout within the viewcell, but when I do, it doesn't work either.
<AbsoluteLayout AbsoluteLayout.LayoutBounds="0,0,1,0.167" AbsoluteLayout.LayoutFlags="All">
