Bug 29820 - Can you please give us a callback to specify the row height for list items?
Summary: Can you please give us a callback to specify the row height for list items?
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.4.1
Hardware: PC Mac OS
: Normal enhancement
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2015-05-06 19:27 UTC by George Cook
Modified: 2017-04-26 18:17 UTC (History)
24 users (show)

Tags: ac
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report for Bug 29820 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description George Cook 2015-05-06 19:27:34 UTC
I've created a fastcell viewcell subclass with much better performance : https://github.com/georgejecook/xamarinFastCell

It works very well in many situations; but it won't currently work with non uniform row heights.

Can you guys please add an api so that a programmer can report the desired cell height of a cell to the listview. This would only need be an optional advanced delegate for programmers who need more control over row heights.
Comment 1 Caan Mee 2015-05-22 17:00:37 UTC
Dear Xamarin Team,

it would be awesome to see this delegate in 1.4.3.

With the FastCell plugin we could finally roll out our app using a Xamarin.Forms ListView.
Comment 2 Jason Smith [MSFT] 2015-05-27 20:10:29 UTC
Thank you for your feature request.
Comment 3 George Cook 2015-05-31 20:09:51 UTC
I'd like to clarify this as well. We can correctly specify the row-height; but it seems it's just based on whatever our viewcell reports.

If we could move that into a delegate, then the behaviour could default to asking the viewcell; but give precedence to the delegate should it be present. This would allow those of us who are getting awesome, native performance, by caching viewcells in listviews to provide variable row heights 

e.g. those of us who are using a handful of viewcells in stead of one per data source item, could delegate the responsibility for calculating row-height to some function outside of the view cell, which coudl correctly ascertain the height for any given row-item. This would allow us to have native performing view cells, with variable row-heights and would not be a breaking change for those who are still jut-jut-stut-stuttering along with hundreds of viewcell objects in their listviews.
Comment 4 Fredy Wenger 2015-06-01 11:06:10 UTC
It seems as the Height of a ListView with HasUnevenRows is calculated false, if the LV is in a StackLayout in a ScrollView (at least when the Height of the LV is smaller then the Page-Height.

See thread here with an example and ScreenShots:

So... this also would help for this problem...
Comment 5 Wes 2015-07-20 13:03:13 UTC
+1 for this feature request... George's FastCell has made a huge difference in proving Xamarin Forms as a viable choice to management for our next app... but we do need variable height cells.
Comment 6 Joshua Novak 2015-08-15 06:23:52 UTC
+1 FastCell is way faster than the normal ListView and it would be great if we could have varying cell heights.
Comment 7 jacanosalado 2015-09-03 05:01:11 UTC
+1 for this feature
Comment 8 Ryan Sakry 2015-09-08 18:47:15 UTC
+1 for this as well!
Comment 9 Ian 2015-09-11 20:43:25 UTC
+1 for this
Comment 10 Anthony 2015-09-25 21:13:28 UTC
+1 for this as well.  I finally got around to reading this in full after a user complained that the ListView scroll did not feel native.

Very insightful!  Thanks :)
Comment 11 Johan Karlsson 2015-10-01 07:14:42 UTC
+1 for this. Sluggish lists are the number one sales killer when it comes to sell Xamarin forms apps.
Comment 12 George Cook 2015-10-01 09:06:02 UTC
by the way guys,

I should add to this, there are many situations in which variable sized FastCells are now working. I've not had a chance to update all the examples yet; but maybe give it a try. As long as you extend the base class correctly (in C# or Xaml), you will get close to native performance.

I've not updated the fastgrid yet; but I shall in due course, too.
Comment 13 Soernt Poppe 2015-10-15 10:33:34 UTC
+1 for this as well!
Comment 14 Chase Florell 2015-10-26 12:13:10 UTC
Comment 15 Jason Smith [MSFT] 2015-10-27 20:13:05 UTC
Since this has seen some action I thought I might give you all a simple method.

If you simply override OnSizeRequest in your top level view in your ViewCell, you can then call base.OnSizeRequest, store that result, and modify the SizeRequest.Request to have a new height. This is effectively what is sizing your cell.
Comment 16 Hines Vaughan III 2015-11-22 19:04:37 UTC
@Jason Smith

Could you possible provide a small sample, especially around the part of calling base.OnSizeRequest and then changing SizeRequest.Request? Would really appreciate the help.
Comment 17 Hines Vaughan III 2015-11-22 19:05:21 UTC
@Jason Smith

Could you possible provide a small sample, especially around the part of
calling base.OnSizeRequest and then changing SizeRequest.Request? Would really
appreciate the help.

*Sorry, reposting to actually reply to Jason... I think.
Comment 18 Matthias H 2017-04-26 18:06:22 UTC
It's been one and a half years and I still can't use the out of the box ListView properly. My ListView always expands more that it should and takes up space unnecessarily. This is especially frustrating when having other views below the ListView, because there is always unused space between the last item in the ListView and the following views.
Comment 19 Ray Kelly 2017-04-26 18:17:30 UTC
I agree, I also cannot use the out of the box ListView on iOS.  Works great on all other platforms.  Uneven rows simply does not work properly.  I have given up hope and resorted to ugly complicated list view renderer code for over 2 years now.