Sreejith Sree
Sreejith Sree

Reputation: 3671

Xamarin Forms : Adjust listview rowheight based on a condition

Is it possible to adjust the row height of a listview based on a condition? My Condition: If the value of {Binding isMediaUrlNull} is true set the height as 250 else 500. Either in xaml or in class I need to add this condition. For avoiding the blank space between the items I am applying this.

Please suggest a solution for this :) Thanks in advance

Upvotes: 0

Views: 303

Answers (1)

Steve Chadbourne
Steve Chadbourne

Reputation: 6953

It may be possible to set the HeightRequest of the Grid that is the parent control in the data template to one of your 2 heights based on a binding condition.

EDIT

Just spun up a quick app to check and yes you can bind the HeightRequest of the parent grid to a Model property.

Make sure you set the HasUnevenRows property of the ListView to True.

Upvotes: 1

Related Questions