The number of columns in a row cannot be updated at runtime

I have the following case: a SFListview with another nested SFListview, in the nested SFListview I am trying to make each row have different columns, but it has to follow some requirements that I am not managing to implement, the nested SFListview has the "Width" property and if It can be modified in runtime with percentages, the minimum is 0 and the maximum 100% that would occupy all the available width, I am assigning all the elements a 'GroupDescriptor' the same so that they are part of the same row but what I want to achieve is that only the elements that add their widths that are less than or equal to 100% of the width are part of the same row, in case the "Width" property is 100% in that column there will be only one element, but if it had two buttons, one with 50% and another with 50% there should be 2 elements in that row and so on, I have prepared a video for you to see how the width change of the buttons works at runtime, I also have an example see what I've done so far on GitHub (I need it to work on: Android, iOS, UWP and macOS):

Video:

https://www.youtube.com/watch?v=C_KbaYlyCK4

GitHub sample:

https://github.com/nacompllo/SfNestedsListView


5 Replies

LN Lakshmi Natarajan Syncfusion Team July 23, 2021 04:04 AM UTC

Hi Sergio, 
 
Thank you for using Syncfusion products. 
 
We have checked the reported query “The number of columns in a row cannot be updated at runtime” from our side. We would like to inform you that the SfListView supports to change the span count at run time, but the column width will be equally split up based on the span count. So, we could not layout items with different width in GridLayout. This is the default behavior of the SfListView with GridLayout. So, we suggest you to set the span count based on the item size. 
 
Please refer to the following online documentation to customize span count, 
KB links: 
 
Also, we have logged a feature request for “Wrap layout in SfListView” feature in SfListView. We will implement this feature in any of our upcoming releases.   
  
At the planning stage for every release cycle, we review all open features and identify features for implementation based on specific parameters including product vision, technological feasibility, and customer interest. We will let you know when this feature is implemented. We appreciate your patience until then.  
 
   
You can also communicate with us regarding the open features any time using our Feature Report page. We will prioritize the features every release based on the demands and we do not have an immediate plan to implement this feature since we committed with already planned work. Please upvote this feature to make this our priority. While this feature itself is important we will prioritize the features every release, based on the user demands.  
   
If you have any more specification/suggestions to the feature request, you can add it as a comment in the portal and cast your vote to make it count.  
 
Please let us know if you need further assistance. 
 
Lakshmi Natarajan 
 



UN Unknown July 23, 2021 04:41 AM UTC

Thanks for the info. The function request " Wrap Layout support in the SfListView " that you have referenced in case of being implemented in the future, would it allow me in the same row to have elements of different widths and heights? or for that would a new function request be required? And another question, so today it is impossible to contain elements of different widths and heights in the same row?



LN Lakshmi Natarajan Syncfusion Team July 26, 2021 06:04 AM UTC

Hi Sergio, 
 
We have checked the reported queries from our side. 
 
Query 
Response 
The function request " Wrap Layout support in the SfListView " that you have referenced in case of being implemented in the future, would it allow me in the same row to have elements of different widths and heights? or for that would a new function request be required? 
As of now, the SfListView supports to have items with different height by using the AutoFitMode property. The wrap layout will allow the items to have different widths in the same row.  
 
Please refer to our user guidance document regarding the same, 
   
We will let you know the details of the additional API or function if required at the time of release.  
 
And another question, so today it is impossible to contain elements of different widths and heights in the same row? 
Yes. As per the implementation of the SfListView, we could not achieve the reported requirement since the column size will be applied to the entire ListView.  
 
 
 
Lakshmi Natarajan 
  
 



UN Unknown July 26, 2021 03:44 PM UTC

Ok thanks for the information. One last question, is it possible to hide the name of the GroupDescriptor? I show you an image where "0" is the GroupDescriptor and I don't know how to remove it.

groupdescriptor.PNG



LN Lakshmi Natarajan Syncfusion Team July 27, 2021 07:44 AM UTC

Hi Sergio, 
 
Thank you for the update. 
 
We have checked the reported query “is it possible to hide the name of the GroupDescriptor?” from our side. You can refer to the following APIs to used hide the GroupHeader in SfListView. 
 
API 
Description 
GroupHeaderSize 
You can customize the size of the GroupHeader by using the SfListView.GroupHeaderSize property. 
 
<listView:SfListView x:Name="listView" GroupHeaderSize="0"> 
 
Please refer to our user guidance document regarding the same, 
 
GroupHeaderTemplate 
If you are using SfListView.AutoFitMode as Height or DynamicHeight, then the size will be calculated based on the template elements. Hence, you can customize the GroupHeaderTemplate with Height 0. 
 
<listView:SfListView x:Name="listView" AutoFitMode="DynamicHeight"> 
                
    <listView:SfListView.GroupHeaderTemplate> 
        <DataTemplate> 
            <Grid HeightRequest="0"> 
                ...                     
            </Grid> 
        </DataTemplate> 
    </listView:SfListView.GroupHeaderTemplate> 
</listView:SfListView> 
 
Please refer to our user guidance document regarding the same, 
 
QueryItemSize 
You can customize any particular GroupHeader height based on the index in the SfListView.QueryItemSize event. 
 
XAML 
<listView:SfListView x:Name="listView" QueryItemSize="listView_QueryItemSize"> 
C# 
private void listView_QueryItemSize(object sender, QueryItemSizeEventArgs e) 
{ 
    if(e.ItemType == ItemType.GroupHeader) 
    { 
        //Hide 1st GroupHeader 
        if(e.ItemIndex == 0) 
        { 
            e.ItemSize = 0; 
            e.Handled = true; 
        } 
    } 
} 
 
Please refer to our online regarding the same, 
 
 
Please let us know if you need further assistance. 
 
Lakshmi Natarajan 
 


Loader.
Up arrow icon