v16.2.0.50 problem using sflistview within stacklayout

if i have code like below, Sflisview is not extending within the Stacklayout and half of the page is empty. I have to      VerticalOptions="FillAndExpand"    to fix the layout. It works in earlier versions. Obviously there is something breaking in this release.


 <StackLayout Orientation="Vertical" VerticalOptions="FillAndExpand">
            <sfListView:SfListView x:Name="list"  ItemsSource="{Binding Items}" SelectionMode="Single" SelectionGesture="Tap"
           SelectedItem="{Binding SelectedItem, Mode=OneWayToSource}"   ItemSpacing="3" AllowSwiping="False"    AllowGroupExpandCollapse="True"  
                    SelectionBackgroundColor= "{DynamicResource backgroundColor}"           GroupHeaderTemplate="{StaticResource GroupHeaderTemplate}">
                <sfListView:SfListView.LayoutManager>
                    <sfListView:GridLayout SpanCount="4" />
                </sfListView:SfListView.LayoutManager>
                <sfListView:SfListView.ItemSize>
                    <OnIdiom x:TypeArguments="x:Double" Phone="150" Tablet="250" Desktop="300" />
                </sfListView:SfListView.ItemSize>

1 Reply

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

Hi Emil,  
  
Thanks for contacting Syncfusion support.  
  
We would like to know that in previous versions when SfListView is loaded inside any layout like Stacklayout, Grid with ColumnDefinitions or RowDefinitions is Auto, the height is not set properly to ListView. So we have fixed this issue by setting the TotalExtent and MinimumHeightRequest to height of the ListView, so it's working in previous version. But this will break when loading the ListView in different layout with more than one children. So now we have fixed all the issues and it included in the current version.    
  
In current version(16.2.0.50), SfListView will have blank space at bottom when loaded in Grid with Row definition as Auto or StackLayout where device width will set as height for SfListView, as this the behavior of Sflistview and Xamarin ListView also holds the similar behavior.     
  
If that’s a case, you can overcome this by defining Grid with Row definition as *  for GridLayout or you can set HeightRequest for SfListView like below while loading).  
  
 
VisualContainer visualContainer;  
visualContainer = listView.GetVisualContainer();  
listView.Loaded += ListView_Loaded;  
 
private void ListView_Loaded(object sender, ListViewLoadedEventArgs e) 
{ 
            var extent = visualContainer.GetType().GetRuntimeProperties().FirstOrDefault(x => x.Name 
=="TotalExtent").GetValue(visualContainer);  
listView.HeightRequest = (double)extent;  
} 
 
  
Regards,  
Jayaleshwari N. 


Loader.
Up arrow icon