We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

SfListView calculate the correct height of item only at the first start or after scrolling.

Hello, 
in our application there is a switch that makes additional lines visible in the list item. If you use the standard xamarin ListView the height is updated correctly. In the SFListView the height of the element is not recalculated.

9 Replies

DB Dinesh Babu Yadav Syncfusion Team September 20, 2017 11:08 AM UTC

Hi Dmitry, 

Sorry for the inconvenience. 

We could able to reproduce the reported issue at our end and we have already logged a defect report for this. The fix for the issue will be available in our upcoming 2017 Volume 3 SP 2 release which is scheduled to be roll out by end of this month. We will let you know once the issue has been resolved and included in the release and we will appreciate your patience until then. 

Please let us know if you require further assistance. 

Regards, 
Dinesh Babu Yadav 
 



MK Muthu Kumaran Gnanavinayagam Syncfusion Team October 10, 2017 11:34 AM UTC

Hi Dmitry, 
 
Sorry for the inconvenience. 
 
Due to Framework hurdles, the reported issue “When AutoFitMode is Height, ListView doesn’t calculate the height of item at runtime” could not be included in 2017 Volume 3 SP 2 release. Now it has been resolved and the fix will be included in our Volume 4 main release. The item size will be updated automatically in the Android and UWP platform.   
  
But need to manually force the SfListView to resize in iOS platform. Because, unable to find out child view’s size changes from parent view as per Xamarin iOS framework architecture. Hence we have introduced a new method ForceUpdateItemSize in SfListView to force the update the item size in iOS platform when its content size is affected. You need to call that method when making changes at runtime like below code snippet.  
  
if (Device.RuntimePlatform == Device.iOS)  
    listView.ForceUpdateItemSize();  
  
Please let us know if you require further assistance. 

Regards, 
G. Muthu Kumaran. 



AS Albu Sorin December 12, 2017 07:30 AM UTC

When this ForceUpdateItemSize() must be called? I put in different places and still no effect. ItemTemplate must be defined in a special way?

Thanks,
Sorin


MK Muthu Kumaran Gnanavinayagam Syncfusion Team December 13, 2017 05:28 PM UTC

Hi Albu, 
 
You have to call for the ForceUpdateItemSize method in SfListView to force update the item size in iOS platform when its content size is affected. 
 
For your reference we have attached the sample and you can download it from the link below. 
 
 
In our sample, we have changed the font size and visibility of the item at runtime using Command in MVVM pattern and SfListView will automatically resize the items based on content. 
 
Please let us know if the provided sample meets your requirement. 
 
Regards, 
G.Muthu kumaran. 



NI Nicolas December 3, 2018 11:03 AM UTC

Hello,

There is a bug on Android : the content is not refreshed (height calculated again) when it should.
I have to scroll down, hide the element out of the screen, scroll up again then the item's height is ok.

I've attached a zip containing an image that shows the bug.

Is there anyway to fix that ? (same for the white area that flicker. See my screenshot for more information : screenshot is documented)

On iOS, I call the force update item size with the index of the row I need to refresh and it works like a charm, without any flickering.

Attachment: bug_android_51f1d382.zip


NI Nicolas December 3, 2018 11:21 AM UTC

Ok ! I found it :

if (Device.RuntimePlatform == Device.iOS)
    ForceUpdateItemSize(index);

else if (Device.RuntimePlatform == Device.Android)
    RefreshListViewItem(index, index);

And my item's height is updated.


JN Jayaleshwari N Syncfusion Team December 4, 2018 09:02 AM UTC

Hi Nicolas, 
 
Thanks for the update.  
 
We have checked the reported query “SfListView calculate the correct height of item only at the first start or after scrolling.” from our side. You can achieve your requirement by using ForceUpdateItemSize or RefreshListViewItem methods. Both will refresh the UI when you call for all the platforms. 
 
We made ForceUpdateItemSize initially to refresh the UI in iOS only. For android and uwp refreshing handled by inbuilt in our source itself which causes layout issues. Now we have provided RefreshListViewItem method in sample level to apply refreshing as per need. We will mark the ForceUpdateItemSize as obsolete in upcoming Volume 4 main release which is scheduled to be rolled out at the middle of December, 2018. 
 
We  will update the UG documentation also regarding this. Please get in touch if you would require further assistance. 
 
Regards,
Jayaleshwari N
 



JH Jeffrey Holmes August 17, 2020 06:22 AM UTC

Hi, 

Has this been fixed - i see no changes when using a event that triggers this RefreshListViewItem();

In thie attached image, you can see the Aqua ListView, after the final ListViewItem was added, extends taking up alot of used space for some reason ?

Thank you.

Image : https://ibb.co/hVVJ7tL


LN Lakshmi Natarajan Syncfusion Team August 17, 2020 10:20 AM UTC

Hi Jeffrey, 
 
Thank you for using Syncfusion products. 
 
We have checked the reported query “ListView height is not updated properly” from our end. We would like to inform you that you can update the ListViewItem based on content size using AutoFitMode API as DynamicHeight.  
 
Please refer the following user guidance document regarding the item size customization from the following link, 
UG links: 
 
Also, we have documented the same requirement in the following link, 
 
Lakshmi Natarajan 
 


Loader.
Live Chat Icon For mobile
Up arrow icon