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 get control selectionion and deselection inside sflistview

i need to create the label dyanmically inside my listview on which user can select and deselect the options inside listview, i want to show this controls in horizontal direction and each this controls have thier own grouping 
can u please help me how can i achieve this functionality using sfcontrols

i have attached the screenshot 

Attachment: helty_928f0ba1.zip

1 Reply

DY Deivaselvan Y Syncfusion Team March 18, 2019 08:57 AM UTC

Hi Ronak, 
 
Thanks for contacting Syncfusion support. 
 
We have checked the reported query from our side. You can load items in SfListView GridLayout by defining SpanCount which places the items in horizontal direction as you mentioned, and you have to define listview with Selection Mode as `Multiple` in order to select items. We have attached the sample for your reference, please refer the sample from below link: 
 
 
 
<syncfusion:SfListView  x:Name="listView" SelectionMode="Multiple" 
                        SelectedItems="{Binding SelectedItems}" 
                        ItemsSource="{Binding contactsinfo}"> 
</syncfusion:SfListView> 
 
 
You can bind the `SelectedItems` to ListView in xaml page by adding the items into SelectedItems in ViewModel as added in sample. 
 
 
public class ContactsViewModel : INotifyPropertyChanged 
{ 
     public ObservableCollection<object> SelectedItems { get; set; } 
 
     public ContactsViewModel() 
     { 
         SelectedItems = new ObservableCollection<object>(); 
 
         SelectedItems.Add(contactsinfo[0]); 
         SelectedItems.Add(contactsinfo[1]); 
     } 
} 
 
 
To know more about Selection in SfListView, please refer our below documentation. 
 
 
Can you please check and let us know whether provide sample meets your requirement. If not, please explain your use case in detail so that we can able to provide the better solution at our end. 
 
Regards, 
Deivaselvan 


Loader.
Live Chat Icon For mobile
Up arrow icon