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

SfListView - Add items manually

6 Replies

UN Unknown Syncfusion Team February 7, 2020 06:24 AM

Hi Fred, 

Thanks for contacting Syncfusion support. 

We have checked your query “Need to know whether gradient panel has property to show shadow border”. Currently we do not have support to meet your requirement and we are checking for work-around to meet your requirement and will update you on 11th February 2020. 

Regards, 
Niranjan Kumar 



DF Dinis Ferreira February 7, 2020 07:02 AM

Hello,
I believe this reply is in the wrong thread.
Thanks


UN Unknown Syncfusion Team February 7, 2020 07:57 AM

Hi Dinis, 

Sorry for the inconvenience caused. 

We have checked your query “Need to add items in SfListItems manually in code behind without using DataSource”. Currently we do not have this support. So we are validating this request with internal team and will let you know on 11th February 2020. 

Regards, 
Niranjan Kumar 



UN Unknown Syncfusion Team February 11, 2020 07:00 AM

Hi Dinis, 

Thanks for your patience. 

If your data source is of type ObservableCollection, SfListView will be automatically updated when there is any change in that collection. So, if you want to add an item, you can directly add it to the data source, provided it is of type ObservableCollection.  

C#: 
public partial class Form1 : Form 
    { 
        ObservableCollection<CountryInfo> countryInfoCollection = new ObservableCollection<CountryInfo>(); 
        public Form1() 
        { 
            InitializeComponent(); 
            sfListView1.DataSource = GetDataSource(); 
            sfListView1.DisplayMember = "CountryName"; 
 
            ObservableCollection<CountryInfo> GetDataSource() 
            { 
                countryInfoCollection.Add(new CountryInfo() { CountryName = "China", Continent = "Asia" }); 
                countryInfoCollection.Add(new CountryInfo() { CountryName = "India", Continent = "Asia" }); 
                countryInfoCollection.Add(new CountryInfo() { CountryName = "Japan", Continent = "Asia" }); 
                countryInfoCollection.Add(new CountryInfo() { CountryName = "Malaysia", Continent = "Asia" }); 
                countryInfoCollection.Add(new CountryInfo() { CountryName = "Singapore", Continent = "Asia" }); 
                 
                return countryInfoCollection; 
            } 
 
        } 
       private void button1_Click(object sender, EventArgs e) 
        { 
            countryInfoCollection.Add(new CountryInfo() { CountryName = "NewCountry1", Continent = "Number1" }); 
        } 
    } 


Regards, 
Niranjan Kumar 



DF Dinis Ferreira February 11, 2020 08:00 AM

Thanks.


UN Unknown Syncfusion Team February 11, 2020 11:38 PM

Hi Dinis,  
 
Thanks for your update. 
 
We are glad to know that the reported query has been resolved at your end. Please let us know if you require further assistance. 
 
Regards, 
Niranjan Kumar Gopalan  


Loader.
Live Chat Icon For mobile
Up arrow icon