smeacham

MyContentPage.cs

May 26th, 2016
336
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.14 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. using Xamarin.Forms;
  8.  
  9. namespace ListViewDemoVS
  10. {
  11.     class MyContentPage : ContentPage
  12.     {
  13.         public MyContentPage()
  14.         {
  15.             Padding = new Thickness(0, Device.OnPlatform(20, 0, 0), 0, 0);
  16.  
  17.             ListView listView = new ListView()
  18.             {
  19.                 ItemTemplate = new DataTemplate(typeof(ListItemCell)),
  20.                 BackgroundColor = Color.Black,
  21.                 HasUnevenRows = true,
  22.                 IsPullToRefreshEnabled = true,
  23.                 ItemsSource = new ListItem[]
  24.                 {
  25.                     new ListItem { Title = "First", Description = "1st" },
  26.                     new ListItem { Title = "Second", Description = "2nd" },
  27.                     new ListItem { Title = "Third", Description = "3rd" },
  28.                     new ListItem { Title = "Fourth", Description = "4th" },
  29.                     new ListItem { Title = "Fifth", Description = "5th" },
  30.                     new ListItem { Title = "Sixth", Description = "6th" },
  31.                     new ListItem { Title = "Seventh", Description = "7th" },
  32.                     new ListItem { Title = "Eighth", Description = "8th" },
  33.                     new ListItem { Title = "Ninth", Description = "9th" },
  34.                     new ListItem { Title = "Tenth", Description = "10th" },
  35.                     new ListItem { Title = "Eleventh", Description = "11th" },
  36.                     new ListItem { Title = "Twelfth", Description = "12th" },
  37.                     new ListItem { Title = "Thirteenth", Description = "13th" },
  38.                     new ListItem { Title = "Fourteenth", Description = "14th" },
  39.                     new ListItem { Title = "Fifteenth", Description = "15th" },
  40.                     new ListItem { Title = "Sixteenth", Description = "16th" },
  41.                     new ListItem { Title = "Seventeenth", Description = "17th" },
  42.                     new ListItem { Title = "Eighteenth", Description = "18th" },
  43.                 }
  44.             };
  45.  
  46.             this.Content = listView;
  47.         }
  48.     }
  49. }
Add Comment
Please, Sign In to add comment