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; |
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" });
}
} |
<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> |