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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

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

Thread ID:

Created:

Updated:

Platform:

Replies:

132752 Sep 19,2017 12:17 PM UTC Dec 4,2018 09:02 AM UTC Xamarin.Forms 7
loading
Tags: SfListView
Dmitry
Asked On September 19, 2017 12:17 PM UTC

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.

Dinesh Babu Yadav [Syncfusion]
Replied On 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 
 


Muthu Kumaran Gnanavinayagam [Syncfusion]
Replied On 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. 


Albu Sorin
Replied On 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

Muthu Kumaran Gnanavinayagam [Syncfusion]
Replied On 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. 


Nicolas
Replied On 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

Nicolas
Replied On 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.

Jayaleshwari N [Syncfusion]
Replied On 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
 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;