Auto expanding listview

Hi,

I have a page with multiple sflistviews on it where the orientation is set to vertical.

As the number of items in the listview are dynamic I want the 'page' to grow based on the size of the listviews instead of having a fixed size and scrollbars coming in.

My pseudo page looks like this.

<Grid x:Name="MainGrid">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="72" />
        <ColumnDefinition Width="400" />
        <ColumnDefinition Width="300" />
        <ColumnDefinition Width="300" />
          <ColumnDefinition Width="*" />
        <ColumnDefinition Width="Auto" />

<Grid Grid.Column="0">// Some non listview data</Grid>
<sflistview Grid.Column="1" ItemsSource="{Binding Items1}" Orientation="Vertical" />
<Grid Grid.Column="2">// Some non listview data</Grid>
<sflistview Grid.Column="3" ItemsSource="{Binding Items2}" Orientation="Vertical" />
<sflistview Grid.Column="4" ItemsSource="{Binding Items3}" Orientation="Vertical" />
</Grid>

Right now it only seems to 'work' if I set the width of the column to a hardcoded size, but i would like to have it auto and than have a scrollview around the whole grid. to scroll the complete screen. (Bit like the old Windows 8 screens.)

Any advice on how to accomplish this?



3 Replies

MK Muthu Kumaran Gnanavinayagam Syncfusion Team October 31, 2017 08:56 AM UTC

Hi Chris, 
 
Thank you for using Syncfusion Products. 
 
We have checked with the reported query “Need to AutoExpand list items” from our side. Currently, we are implementing LoadMore support in our source and it will be available for use from our upcoming 2017 Volume 4 main release. However you can achieve your requirement through a workaround as of now. You can load more items on demand by determining whether the end of the items is reached using Changed event of ScrollAxisBase. We have already published KB regarding this and you can refer the same from the link below. 
 
 
Please let us know if you require further assistance. 
 
Regards, 
G.Muthu Kumaran. 



CH Chris October 31, 2017 10:23 AM UTC

Hi,

Thanks for you reply. This is hower not what i'm looking for. I'm looking for a way to make the listview change it's size based on the content instead of showing scrollbars. So I would like to have a columndefinition set to Width="Auto" so it will take the exact amount of space necesary to show the items without scrollbars.



MK Muthu Kumaran Gnanavinayagam Syncfusion Team November 1, 2017 04:29 PM UTC

Hi Chris, 
 
We have checked the reported query “Need for a Non-scrollable ListView” from our side. We would like to let you know that the SfListView is implemented with ScrollView. Hence, SfListView gets scrollable once the items exceeds the view size and it’s actual behavior. If you want to expand the listview, you need to adjust the height of SfListView based on items. To meet your requirements, we have prepared a simple sample in which we have manually measured the TotalExtent of SfListView and layout the children inside the Grid. To fit the contents of the SfListView item into the Grid based on its size you can need to set the value for AutoFitMode as ‘Height’. We have already included regarding this in our documentation and you can refer the same from the below link. 
 
 
For your reference, we have attached the working sample link below. 
 
 
Note: We strongly recommend you not to use SfListView inside ScrollView as it leads to degrading the performance of SfListView which we have already mentioned in our documentation. Please refer the documentation link below for more information. 
 
 
Please let us know if you require further assistance. 
 
Regards, 
G.Muthu Kumaran. 


Loader.
Up arrow icon