SfListView unknown spaces above some items?

Hi,

I've implemented the SfPullToRefresh and SfListView as the documentation described. The project perfectly works in UWP and Android but it does not

work well in iOS. The problem is in iOS, above some items, there are huge unknown spaces. I will share the XAML and I attached some files about the

issue. Thanks for your time and consideration.

Visual Studio Version: 15.6.6
Operating System: Windows 10

NugetPackages
Xamarin.Forms Version: 2.5.0.280555

Syncfusion.Xamarin.SfListView Version: 16.1.0.37

Syncfusion.Xamarin.SfPullToRefresh Version: 16.2.0.42

Regards 
Ali

Attachment: Example_c05679a5.rar

3 Replies

DY Deivaselvan Y Syncfusion Team September 10, 2018 04:01 AM UTC

Hi Ali, 

Thank you for contacting Syncfusion support.

You couldn’t achieve the requirement to render both outer and nested listview based on AutoFitMode as ‘Height’. Hence the size for the inner listview cannot be calculated based on AutoFitMode as ‘Height’ and we have already mentioned it as limitation in our documentation. 

UG Documentation:
https://help.syncfusion.com/xamarin/sflistview/item-size-customization#limitations 

To achieve your requirement, you need to define the size for each inner listview in QueryItemSize event of the outer listview as like  below. 

Code Example[C#]:  
private void ListView_QueryItemSize(object sender, Syncfusion.ListView.XForms.QueryItemSizeEventArgs e)  
{  
  if (e.ItemType == Syncfusion.ListView.XForms.ItemType.Record)  
  {  
    var data = e.ItemData as ContactInfo_NestedListView;  
    e.ItemSize = data.Count * 75;  
    e.Handled = true;  
  }  
}  

Now the items are rendered as expected in the View. If the list items are scrollable, then the size for each item need to be updated while scrolling. As we have recycled each item which are to be rendered in the View by updating its BindingContext, the items will not be rendered properly as the layouting action is done simultaneously in the same thread. So, you need to update the container size for the inner listview in threading as below.

Code Example[C#]:  
public class ExtendedListView : SfListView  
    {  
  
        VisualContainer container;  
        public ExtendedListView()  
        {  
            container = this.GetVisualContainer();  
            container.PropertyChanged += Container_PropertyChanged;  
       }  
  
        private void Container_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)  
        {  
            Device.BeginInvokeOnMainThread(async () =>  
            {  
                var totalextent = (double)container.GetType().GetRuntimeProperties().FirstOrDefault(container => container.Name == "TotalExtent").GetValue(container);  
                if (e.PropertyName == "Height")  
                    HeightRequest = totalextent;  
                 container.ForceLayout();  
            });  
        }  
   }  

For your reference, we have attached working sample and you download it from the below location.

Sample link:
http://www.syncfusion.com/downloads/support/forum/139617/ze/ListViewSample1662346527  

Please let us know if you require further assistance. 

Regards,
Gnana Priya N 



AL Ali September 10, 2018 12:48 PM UTC

Thanks for your time and consideration. It works now!


JN Jayaleshwari N Syncfusion Team September 11, 2018 11:38 AM UTC

Hi Ali,  
 
Thanks for the update.  
we are glad to hear that your issue has been fixed. Please let us know if you need any assistance. 
 
Regards, 
Jayaleshwari N. 


Loader.
Up arrow icon