Advertisement
smeacham

ListItemCell.cs

May 26th, 2016
383
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.53 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. using System.Diagnostics;
  9.  
  10. namespace ListViewDemoVS
  11. {
  12.     class ListItemCell : ViewCell
  13.     {
  14.         public ListItemCell()
  15.         {
  16.             Label titleLabel = new Label
  17.             {
  18.                 HorizontalOptions = LayoutOptions.FillAndExpand,
  19.                 FontSize = 25,
  20.                 FontAttributes = Xamarin.Forms.FontAttributes.Bold,
  21.                 TextColor = Color.White
  22.             };
  23.             titleLabel.SetBinding(Label.TextProperty, "Title");
  24.  
  25.             Label descLabel = new Label
  26.             {
  27.                 HorizontalOptions = LayoutOptions.FillAndExpand,
  28.                 FontSize = 12,
  29.                 TextColor = Color.White
  30.             };
  31.             descLabel.SetBinding(Label.TextProperty, "Description");
  32.  
  33.             StackLayout viewLayoutItem = new StackLayout()
  34.             {
  35.                 HorizontalOptions = LayoutOptions.StartAndExpand,
  36.                 Orientation = StackOrientation.Vertical,
  37.                 Children = { titleLabel, descLabel }
  38.             };
  39.  
  40.             StackLayout viewLayout = new StackLayout()
  41.             {
  42.                 HorizontalOptions = LayoutOptions.StartAndExpand,
  43.                 Orientation = StackOrientation.Horizontal,
  44.                 Padding = new Thickness(25, 10, 55, 15),
  45.                 Children = { viewLayoutItem }
  46.             };
  47.  
  48.             View = viewLayout;
  49.         }
  50.     }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement