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. Image for the cookie policy date
close icon

How to clear grouping when long pressing on a caption row?

Is it possible to do the same action as below article on SflistView?  I cant figure out because itemholding event is not responding on a group header in sflistview
https://www.syncfusion.com/kb/7372/how-to-clear-grouping-when-long-pressing-on-a-caption-row

1 Reply

MK Muthu Kumaran Gnanavinayagam Syncfusion Team September 29, 2017 09:26 AM UTC

Hi Emil, 
 
We have checked your query “Need to clear Grouping while holding the GroupHeader item” at our end. We regret to let you know that when BackgroundColor is set for the DataTemplate of GroupHeaderTemplate, the ItemHolding will not be triggered. So we have already logged a bug report regarding this issue. Fortunately this issue has been resolved and it will be included in our 2017 Volume 3 SP 2 release. You can clear the Grouping of list items as like the below code snippets. 
 
Code example[XAML]: 
            <listView:SfListView x:Name="listView" 
                           ItemsSource="{Binding contactsinfo}"  
                           ItemHolding="ListView_ItemHolding"> 
 
                <listView:SfListView.GroupHeaderTemplate> 
                    <DataTemplate> 
                        <ViewCell> 
                            <ViewCell.View> 
                                <Grid BackgroundColor="#E4E4E4"> 
                                    <Label Text="{Binding Key}"/> 
                                </Grid> 
                            </ViewCell.View> 
                        </ViewCell> 
                    </DataTemplate> 
                </listView:SfListView.GroupHeaderTemplate> 
            </listView:SfListView> 
 
 
Code example[C#]: 
        private void ListView_ItemHolding(object sender, ItemHoldingEventArgs e) 
        { 
            if (e.ItemType == ItemType.GroupHeader) 
              listView.DataSource.GroupDescriptors.Clear(); 
        } 
 
Please let us know if you require further assistance. 

Regards, 
G.Muthu Kumaran. 


Loader.
Live Chat Icon For mobile
Up arrow icon