How to set ListView row height in Xamarin.Forms

I want to set the ListView height in a XAML file for an iOS device using the code and bindings below.

1) I used the observable collection to notify me when a property value is updated and it receives a notification and sets the correct value, but it does not appear in iOS Simulator or device, but works fine with Android and Windows Phone devices.

<ListView Grid.Row="2" Grid.Column="1" ItemsSource="{Binding QuestionAnswerList,Mode=TwoWay}" SelectedItem="{Binding SelectedData,Mode=TwoWay}" HasUnevenRows="true" RowHeight="{Binding Custom_height,Mode=TwoWay}" BackgroundColor="Silver" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"> <ListView.ItemTemplate> 

2) I tried setting the Row Height of List View statically, but this also does not work.

3) I did not set the height and did not set the Grid RowDefinition height = "*", but then it also does not set the height of the ListView, and does not overlap the details in the next row of the ListView.

Thanks.

+5
source share
1 answer

On iOS , when you set ListView.HasUnevenRows to true , you must also set the Cell.Height property for each cell property , since the rendering cannot pull it out of the content.

You can also use ListView.RowHeight , as in your example, for even rows. In this case, do not set ListView.HsUnevenRows (or set it to false ).

+12
source

Source: https://habr.com/ru/post/1202679/


All Articles