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

new to syncfusion and even more to SfListView

Hi every Body,

     I started in xamarin, i'am in a first project, i have a listview that a create using de tools of xamarin and i'm tryng to use syncfusion , but man, all the examples are created ( i think ) to someone with more knowledge that i have, someone has a example pass-by-pass basic level ? A ultra super easy project with a example of sflistview working could help two :).

Att,
Sidival

5 Replies

SR Sangeetha Raju Syncfusion Team October 14, 2019 06:51 AM UTC

Hi Sidival, 
 
We would like to inform you that we have updated our documentation about SfListView in detail. Please refer the below link for further information.  
 
 
 
Please get back to us, if you require any further assistance. 
 
Regards, 
Sangeetha Raju. 



SF Sidival Felisberto October 14, 2019 10:55 AM UTC

Hi Sangeetha,

     Thank you, but I'm try to do a Listview with a subitems, and that example is like the others, don't say the basic, for example that you shoulb install the packages before, I'm developer of languages like Clipper, Vbasic e and Progress ( Openedge) and that is being very difficult for me to try to learn something because all the examples and not only from the Xamarim world the Android Studio folks make the same mistake, everyone imagines that on the other side of the tutorials is an almost master of language and then obvious details like the install packages first go unnoticed and then when trying to run the tutorial nothing works. But thank you for your feedback and I will keep looking for an example that works :).

Att,
Sidival



SR Sangeetha Raju Syncfusion Team October 16, 2019 04:06 AM UTC

Hi Sidival, 
 
We would like to inform you that you can display the collection of items in SfListView by using the ItemsSource property. We  have prepared the simple basic sample in c# for your better understanding. Please find the sample from the below link. 
 
var Items = new ObservableCollection<string>(); 
for (int i = 0; i < 20; i++) 
{ 
   Items.Add("Item:" + i); 
} 
 
var listview = new SfListView(); 
listview.ItemsSource = Items; 
 
this.Content = listview; 
 
 
Moreover, you can refer the following link for adding the nuget references. 
 
 
Also, you can create a data objects in Model class and maintain a collection of model data objects in BooksInfo property in ViewModel class as like below code snippet.  
 
public class Model 
{ 
   public string BookName { get; set; } 
     
   public string BookDescription { get; set; } 
} 
 
public class ViewModel 
{ 
   public ObservableCollection<Model> BookInfo { get; set; } 
 
   public ViewModel() 
   { 
      BookInfo = new ObservableCollection<Model>(); 
      BookInfo.Add(new Model() { BookName = "Object-Oriented Programming in C#", BookDescription = "Object-oriented programming is the de facto programming paradigm" }); 
      BookInfo.Add(new Model() { BookName = "C# Code Contracts", BookDescription = "Code Contracts provide a way to convey code assumptions" }); 
      BookInfo.Add(new Model() { BookName = "Machine Learning Using C#", BookDescription = "You’ll learn several different approaches to applying machine learning" }); 
      BookInfo.Add(new Model() { BookName = "Neural Networks Using C#", BookDescription = "Neural networks are an exciting field of software development" }); 
      BookInfo.Add(new Model() { BookName = "Visual Studio Code", BookDescription = "It is a powerful tool for editing code and serves for end-to-end programming" }); 
      BookInfo.Add(new Model() { BookName = "Android Programming", BookDescription = "It is provides a useful overview of the Android application lifecycle" }); 
      BookInfo.Add(new Model() { BookName = "iOS Succinctly", BookDescription = "It is for developers looking to step into frightening world of iPhone" }); 
      BookInfo.Add(new Model() { BookName = "Visual Studio 2015", BookDescription = "The new version of the widely-used integrated development environment" }); 
      BookInfo.Add(new Model() { BookName = "Xamarin.Forms", BookDescription = "Its creates mappings from its C# classes and controls directly" }); 
      BookInfo.Add(new Model() { BookName = "Windows Store Apps", BookDescription = "Windows Store apps present a radical shift in Windows development" }); 
      BookInfo.Add(new Model() { BookName = "Agile Software Development", BookDescription = "Learning new development processes can be difficult" }); 
      BookInfo.Add(new Model() { BookName = "Assembly Language", BookDescription = "Assembly language is as close to writing machine code" }); 
      BookInfo.Add(new Model() { BookName = "Cryptography in .NET", BookDescription = "Cryptography is used throughout software to protect all kinds of information" }); 
      BookInfo.Add(new Model() { BookName = "Entity Framework Code First", BookDescription = "Follow author Ricardo Peres as he introduces the newest development mode" }); 
      BookInfo.Add(new Model() { BookName = "Localization for .NET", BookDescription = "Learn to write applications that support different languages and cultures" }); 
   } 
} 
 
Now, you can display the collection of items in SfListView by binding the BooksInfo property to the ItemsSource property with the BindingContext as ViewModel and then bind the model data objects in the ItemTemplate as like below code snippet. 
 
<ContentPage.BindingContext> 
   <local:ViewModel /> 
</ContentPage.BindingContext>    
 
<sync:SfListView x:Name="listView"  
                 ItemsSource="{Binding BookInfo}" 
                 ItemSize="100"> 
   <sync:SfListView.ItemTemplate> 
      <DataTemplate> 
         <Grid Padding="10"> 
            <Grid.RowDefinitions> 
                <RowDefinition Height="0.4*" /> 
                <RowDefinition Height="0.6*" /> 
             </Grid.RowDefinitions> 
             <Label x:Name="label" Text="{Binding BookName}" FontSize="21" FontAttributes="Bold"/> 
             <Label Grid.Row="1" Text="{Binding BookDescription}" FontSize="15"/> 
          </Grid> 
       </DataTemplate> 
    </sync:SfListView.ItemTemplate> 
</sync:SfListView> 
 
We have attached the sample for you reference. Please find the sample from the below link. 
 
 
Please let us know if you require any further assistance. 
 
Regards, 
Sangeetha Raju. 



SF Sidival Felisberto October 18, 2019 01:19 AM UTC

Sangeetha Raju., good nigth , Thank you a lot, your example worked :).


SR Sangeetha Raju Syncfusion Team October 18, 2019 06:03 AM UTC

Hi Sidival, 
 
Thanks for the update. We glad for our sample works. Please let us know if you have any further assistance. 
 
Regards, 
Sangeetha Raju. 


Loader.
Live Chat Icon For mobile
Up arrow icon