Exemple #1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            dataSource.LoadDataFromJSONResource("ListViewSampleData", "json", "teams");
            dataSource.GroupItemSourceKey = "items";
            dataSource.FilterWithQuery("key like 'Marketing'");
            dataSource.GroupWithKey("key");

            this.UpdateData(3);

            this.listViewDataSource = new ListViewDataSource(this);
            this.listViewDelegate   = new ListViewDelegate(this);

            TKListView listView = new TKListView(this.View.Bounds);

            listView.RegisterClassForCell(new ObjCRuntime.Class(typeof(TKListViewCell)), "cell");
            listView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            listView.DataSource       = this.listViewDataSource;
            listView.Delegate         = this.listViewDelegate;

            // >> listview-pull-to-refresh-cs
            listView.AllowsPullToRefresh = true;
            // << listview-pull-to-refresh-cs

            listView.PullToRefreshTreshold                     = 70;
            listView.PullToRefreshView.BackgroundColor         = UIColor.Blue;
            listView.PullToRefreshView.ActivityIndicator.Color = UIColor.White;
            this.View.AddSubview(listView);
        }
Exemple #2
0
        public override void ViewDidLoad()
        {
            this.AddOption("Manual", "Load on demand mode", LoadOnDemandManual);
            this.AddOption("Auto", "Load on demand mode", LoadOnDemandAuto);

            base.ViewDidLoad();

            this.photos.LoadDataFromJSONResource("PhotosWithNames", "json", "photos");
            this.names.LoadDataFromJSONResource("PhotosWithNames", "json", "names");

            this.listViewDataSource = new ListViewDataSource(this);
            this.listViewDelegate   = new ListViewDelegate(this);

            listView.Frame                  = this.View.Bounds;
            listView.BackgroundColor        = new UIColor(0.0f, 1.0f, 0.0f, 0.5f);
            listView.AutoresizingMask       = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
            listView.Delegate               = this.listViewDelegate;
            listView.DataSource             = this.listViewDataSource;
            listView.LoadOnDemandBufferSize = 5;
            listView.LoadOnDemandMode       = TKListViewLoadOnDemandMode.Manual;
            listView.ContentInset           = new UIEdgeInsets(10, 10, 10, 10);
            this.View.AddSubview(listView);
            listView.RegisterClassForCell(new ObjCRuntime.Class(typeof(CustomCardListViewCell)), "cell");

            TKListViewLinearLayout layout = (TKListViewLinearLayout)listView.Layout;

            layout.ItemSize      = new CGSize(100, 120);
            layout.ItemSpacing   = 5;
            layout.ItemAlignment = TKListViewItemAlignment.Stretch;
        }
        public override void ViewDidLoad()
        {
            this.AddOption ("Manual", LoadOnDemandManual, "Load on demand mode");
            this.AddOption ("Auto", LoadOnDemandAuto, "Load on demand mode");

            base.ViewDidLoad ();

            this.photos.LoadDataFromJSONResource ("PhotosWithNames", "json", "photos");
            this.names.LoadDataFromJSONResource ("PhotosWithNames", "json", "names");

            this.listViewDataSource = new ListViewDataSource (this);
            this.listViewDelegate = new ListViewDelegate (this);

            listView.Frame = this.View.Bounds;
            listView.BackgroundColor = new UIColor (0.0f, 1.0f, 0.0f, 0.5f);
            listView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
            listView.Delegate = this.listViewDelegate;
            listView.DataSource = this.listViewDataSource;
            listView.LoadOnDemandBufferSize = 5;
            listView.LoadOnDemandMode = TKListViewLoadOnDemandMode.Manual;
            listView.ContentInset = new UIEdgeInsets (10, 10, 10, 10);
            this.View.AddSubview (listView);
            listView.RegisterClassForCell(new ObjCRuntime.Class(typeof(CustomCardListViewCell)), "cell");

            TKListViewLinearLayout layout = (TKListViewLinearLayout)listView.Layout;
            layout.ItemSize = new CGSize (100, 120);
            layout.ItemSpacing = 5;
            layout.ItemAlignment = TKListViewItemAlignment.Stretch;
        }
        public override void ViewDidLoad()
        {
            this.AddOption ("Selection on press", SelectionOnPressSelected, "Selection type");
            this.AddOption ("Selection on hold", SelectionOnHoldSelected, "Selection type");
            this.AddOption ("No selection", NoSelectionSelected, "Selection type");
            this.AddOption ("YES", MultipleSelectionSelected, "Multiple selection");
            this.AddOption ("NO", SingleSelectionSelected, "Multiple selection");

            base.ViewDidLoad ();

            this.dataSource.LoadDataFromJSONResource ("ListViewSampleData", "json", "players");

            this.label.Frame = new CGRect (0, this.View.Bounds.Height - 44, this.View.Bounds.Size.Width, 44);
            this.label.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleTopMargin;
            this.label.TextAlignment = UITextAlignment.Center;
            this.View.AddSubview (this.label);

            this.listViewDelegage = new ListViewDelegate (this);

            this.listView.Frame = new CGRect (0, 0, this.View.Bounds.Size.Width, this.View.Bounds.Size.Height - 55);
            this.listView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            this.listView.Delegate = this.listViewDelegage;
            this.listView.WeakDataSource = this.dataSource;
            this.listView.SelectionBehavior = TKListViewSelectionBehavior.Press;
            this.listView.AllowsMultipleSelection = true;
            this.View.AddSubview (this.listView);

            TKListViewLinearLayout layout = new TKListViewLinearLayout ();
            layout.ItemAlignment = TKListViewItemAlignment.Stretch;
            layout.ItemSpacing = 0;

            NSIndexPath indexPath = NSIndexPath.FromRowSection (1, 0);
            this.listView.SelectItem (indexPath, false, UICollectionViewScrollPosition.None);
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            dataSource.LoadDataFromJSONResource ("ListViewSampleData", "json", "teams");
            dataSource.GroupItemSourceKey = "items";
            dataSource.FilterWithQuery ("key like 'Marketing'");
            dataSource.GroupWithKey ("key");

            this.UpdateData (3);

            this.listViewDataSource =  new ListViewDataSource (this);
            this.listViewDelegate = new ListViewDelegate (this);

            TKListView listView = new TKListView (this.View.Bounds);
            listView.RegisterClassForCell (new ObjCRuntime.Class (typeof(TKListViewCell)), "cell");
            listView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            listView.DataSource = this.listViewDataSource;
            listView.Delegate = this.listViewDelegate;
            listView.AllowsPullToRefresh = true;
            listView.PullToRefreshTreshold = 70;
            listView.PullToRefreshView.BackgroundColor = UIColor.Blue;
            listView.PullToRefreshView.ActivityIndicator.Color = UIColor.White;
            this.View.AddSubview (listView);
        }
        public override void ViewDidLoad()
        {
            this.AddOption("Reorder with handle", ReorderWithHandleSelected);
            this.AddOption("Reorder with long press", ReorderWithLongPressSelected);
            this.AddOption("Disable reorder mode", DisableReorderSelected);

            base.ViewDidLoad();

            // >> listview-datasource-reorder-cs
            this.listView.WeakDataSource      = this.dataSource;
            this.dataSource.AllowItemsReorder = true;
            // << listview-datasource-reorder-cs

            this.dataSource.LoadDataFromJSONResource("PhotosWithNames", "json", "names");

            // >> listview-delegate-set-cs
            this.listViewDelegate = new ListViewDelegate(this);
            // << listview-delegate-set-cs

            this.listView.Frame            = this.View.Bounds;
            this.listView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            this.listView.WeakDelegate     = this.listViewDelegate;

            // >> listview-reorder-cs
            this.listView.AllowsCellReorder = true;
            // << listview-reorder-cs

            this.View.AddSubview(listView);
        }
Exemple #7
0
        public override void ViewDidLoad()
        {
            this.AddOption("Selection on press", "Selection type", SelectionOnPressSelected);
            this.AddOption("Selection on hold", "Selection type", SelectionOnHoldSelected);
            this.AddOption("No selection", "Selection type", NoSelectionSelected);
            this.AddOption("YES", "Multiple selection", MultipleSelectionSelected);
            this.AddOption("NO", "Multiple selection", SingleSelectionSelected);

            base.ViewDidLoad();

            this.dataSource.LoadDataFromJSONResource("ListViewSampleData", "json", "players");

            this.label.Frame            = new CGRect(0, this.View.Bounds.Height - 44, this.View.Bounds.Size.Width, 44);
            this.label.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleTopMargin;
            this.label.TextAlignment    = UITextAlignment.Center;
            this.View.AddSubview(this.label);

            this.listViewDelegage = new ListViewDelegate(this);

            this.listView.Frame            = new CGRect(0, 0, this.View.Bounds.Size.Width, this.View.Bounds.Size.Height - 55);
            this.listView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            this.listView.Delegate         = this.listViewDelegage;
            this.listView.WeakDataSource   = this.dataSource;

            // >> listview-selection-behavior-cs
            this.listView.SelectionBehavior = TKListViewSelectionBehavior.Press;
            // << listview-selection-behavior-cs

            // >> listview-multiple-selection-cs
            this.listView.AllowsMultipleSelection = true;
            // << listview-multiple-selection-cs

            this.View.AddSubview(this.listView);

            TKListViewLinearLayout layout = new TKListViewLinearLayout();

            layout.ItemAlignment = TKListViewItemAlignment.Stretch;
            layout.ItemSpacing   = 0;

            // >> listview-selection-programatically-cs
            NSIndexPath indexPath = NSIndexPath.FromRowSection(1, 0);

            this.listView.SelectItem(indexPath, false, UICollectionViewScrollPosition.None);
            // << listview-selection-programatically-cs
        }
        public override void ViewDidLoad()
        {
            this.AddOption ("Reorder with handle", ReorderWithHandleSelected);
            this.AddOption ("Reorder with long press", ReorderWithLongPressSelected);
            this.AddOption ("Disable reorder mode", DisableReorderSelected);

            base.ViewDidLoad ();

            this.dataSource.AllowItemsReorder = true;
            this.dataSource.LoadDataFromJSONResource ("PhotosWithNames", "json", "names");

            this.listViewDelegate = new ListViewDelegate(this);

            this.listView.Frame = this.View.Bounds;
            this.listView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            this.listView.WeakDataSource = this.dataSource;
            this.listView.WeakDelegate = this.listViewDelegate;
            this.listView.AllowsCellReorder = true;
            this.View.AddSubview (listView);
        }
        public override void ViewDidLoad()
        {
            this.AddOption("YES", "Animate buttons", EnableButtonAnimation);
            this.AddOption("NO", "Animate buttons", DisableButtonAnimation);

            base.ViewDidLoad();

            buttonAnimationEnabled = true;
            NSMutableDictionary mails = new NSMutableDictionary();

            mails.Add(new NSString("Joyce Dean"), new NSString("Sales report for January"));
            mails.Add(new NSString("Joel Robertson"), new NSString("Planned network mainternance"));
            mails.Add(new NSString("Sherman Martin"), new NSString("IT help desk"));
            mails.Add(new NSString("Lela Richardson"), new NSString("Summaries of my interviews with customers"));
            mails.Add(new NSString("Jackie Maldonado"), new NSString("REMAINDER: corporate meeting"));
            mails.Add(new NSString("Kathryn Byrd"), new NSString("Stock options"));
            mails.Add(new NSString("Ervin Powers"), new NSString("Thank you!"));
            mails.Add(new NSString("Leland Warner"), new NSString("Meeting with Jack"));
            mails.Add(new NSString("Nicholas Bowers"), new NSString("Please share these articles"));
            mails.Add(new NSString("Alex Soto"), new NSString("Additional information for Jack"));
            mails.Add(new NSString("Naomi Carson"), new NSString("Miss you!"));
            mails.Add(new NSString("Lela Richardson"), new NSString("Summaries of my interviews with customers"));
            mails.Add(new NSString("Rufus Edwards"), new NSString("Training"));
            mails.Add(new NSString("Kathryn Byrd"), new NSString("Stock options"));
            mails.Add(new NSString("Ian Ellis"), new NSString("Do you like this blog article?"));
            mails.Add(new NSString("Pat Vasquez"), new NSString("The latest UI design"));
            mails.Add(new NSString("Chelsea Burton"), new NSString("Need this article!"));
            mails.Add(new NSString("Karl Bates"), new NSString("Training update"));
            mails.Add(new NSString("Evan Rivera"), new NSString("Safety instructions"));
            mails.Add(new NSString("Tony Lawson"), new NSString("Missed our converstation"));
            mails.Add(new NSString("Wallace Little"), new NSString("Swift is awessome"));
            mails.Add(new NSString("Carrie Tran"), new NSString("Missed conference call with Jack"));
            mails.Add(new NSString("Tyler Washington"), new NSString("HR question"));
            mails.Add(new NSString("Dominick Holloway"), new NSString("Wellcome!"));
            mails.Add(new NSString("Clark Sharp"), new NSString("Important question!"));

            this.dataSource.ItemSource = mails;
            this.dataSource.Settings.ListView.CreateCell(delegate(TKListView listView, NSIndexPath indexPath, NSObject item) {
                TKListViewCell cell = listView.DequeueReusableCell("defaultCell", indexPath) as TKListViewCell;
                // >> listview-swipe-view-cs
                if (cell.SwipeBackgroundView.Subviews.Length == 0)
                {
                    CGSize size    = cell.Frame.Size;
                    UIFont font    = UIFont.SystemFontOfSize(14);
                    UIButton bMore = new UIButton(new CGRect(size.Width - 180, 0, 60, size.Height));
                    bMore.SetTitle("More", UIControlState.Normal);
                    bMore.BackgroundColor = UIColor.LightGray;
                    bMore.TitleLabel.Font = font;
                    bMore.AddTarget(ButtonTouched, UIControlEvent.TouchUpInside);
                    cell.SwipeBackgroundView.AddSubview(bMore);

                    UIButton bFlag = new UIButton(new CGRect(size.Width - 120, 0, 60, size.Height));
                    bFlag.SetTitle("Flag", UIControlState.Normal);
                    bFlag.BackgroundColor = UIColor.Orange;
                    bFlag.TitleLabel.Font = font;
                    bFlag.AddTarget(ButtonTouched, UIControlEvent.TouchUpInside);
                    cell.SwipeBackgroundView.AddSubview(bFlag);

                    UIButton bTrash = new UIButton(new CGRect(size.Width - 60, 0, 60, size.Height));
                    bTrash.SetTitle("Trash", UIControlState.Normal);
                    bTrash.BackgroundColor = UIColor.Red;
                    bTrash.TitleLabel.Font = font;
                    bTrash.AddTarget(ButtonTouched, UIControlEvent.TouchUpInside);
                    cell.SwipeBackgroundView.AddSubview(bTrash);

                    UIButton bUnread = new UIButton(new CGRect(0, 0, 60, size.Height));
                    bUnread.SetTitle("Mark as Unread", UIControlState.Normal);
                    bUnread.BackgroundColor          = UIColor.Blue;
                    bUnread.TitleLabel.Font          = font;
                    bUnread.TitleLabel.LineBreakMode = UILineBreakMode.WordWrap;
                    bUnread.TitleLabel.TextAlignment = UITextAlignment.Center;
                    bUnread.AddTarget(ButtonTouched, UIControlEvent.TouchUpInside);
                    cell.SwipeBackgroundView.AddSubview(bUnread);
                }
                // << listview-swipe-view-cs

                return(cell);
            });

            this.dataSource.Settings.ListView.InitCell(delegate(TKListView listView, NSIndexPath indexPath, TKListViewCell cell, NSObject item) {
                cell.TextLabel.Text = item as NSString;
                NSDictionary dict   = this.dataSource.ItemSource as NSDictionary;
                cell.DetailTextLabel.AttributedText = this.AttributedMailText(dict[item] as NSString);
                cell.ContentInsets = new UIEdgeInsets(5, 10, 5, 10);
            });

            this.listViewDelegate = new ListViewDelegate(this);

            this.listView.Frame            = this.View.Bounds;
            this.listView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            this.listView.WeakDataSource   = this.dataSource;
            this.listView.Delegate         = this.listViewDelegate;

            // >> listview-swipe-cs
            this.listView.AllowsCellSwipe = true;
            // << listview-swipe-cs

            // >> listview-swipe-limits-cs
            this.listView.CellSwipeLimits = new UIEdgeInsets(0, 60, 0, 180);
            // << listview-swipe-limits-cs

            // >> listview-swipe-treshold-cs
            this.listView.CellSwipeTreshold = 30;
            // << listview-swipe-treshold-cs

            this.View.AddSubview(this.listView);

            TKListViewLinearLayout layout = (TKListViewLinearLayout)this.listView.Layout;

            layout.ItemSize = new CGSize(100, 80);
        }
Exemple #10
0
        public override void ViewDidLoad()
        {
            AddOption("Show Alert", Show);

            base.ViewDidLoad();

            this.listViewDelegate = new ListViewDelegate(this);

            alert       = new TKAlert();
            alert.Title = "Animations";
            alert.Style.BackgroundStyle = TKAlertBackgroundStyle.Blur;
            alert.AddActionWithTitle("Close", (TKAlert al, TKAlertAction action) => true);

            showAnimations = new NSMutableArray();
            showAnimations.Add(new NSString("Scale in"));
            showAnimations.Add(new NSString("Fade in"));
            showAnimations.Add(new NSString("Slide from left"));
            showAnimations.Add(new NSString("Slide from top"));
            showAnimations.Add(new NSString("Slide from right"));
            showAnimations.Add(new NSString("Slide from bottom"));

            dismissAnimations = new NSMutableArray();
            dismissAnimations.Add(new NSString("Scale out"));
            dismissAnimations.Add(new NSString("Fade out"));
            dismissAnimations.Add(new NSString("Slide to left"));
            dismissAnimations.Add(new NSString("Slide to top"));
            dismissAnimations.Add(new NSString("Slide to right"));
            dismissAnimations.Add(new NSString("Slide to bottom"));

            appearAnimations = new TKDataSource(showAnimations);
            hideAnimations   = new TKDataSource(dismissAnimations);

            appearAnimationsList = new TKListView();
            appearAnimationsList.WeakDataSource   = appearAnimations;
            appearAnimationsList.Delegate         = listViewDelegate;
            appearAnimationsList.Tag              = 0;
            appearAnimationsList.AutoresizingMask = UIViewAutoresizing.None;
            this.View.AddSubview(appearAnimationsList);

            NSIndexPath selected = NSIndexPath.FromItemSection(3, 0);

            appearAnimationsList.SelectItem(selected, true, UICollectionViewScrollPosition.None);

            hideAnimationsList = new TKListView();
            hideAnimationsList.WeakDataSource   = hideAnimations;
            hideAnimationsList.Tag              = 1;
            hideAnimationsList.Delegate         = listViewDelegate;
            hideAnimationsList.AutoresizingMask = UIViewAutoresizing.None;
            this.View.AddSubview(hideAnimationsList);

            selected = NSIndexPath.FromItemSection(5, 0);
            hideAnimationsList.SelectItem(selected, true, UICollectionViewScrollPosition.None);

            appearLabel               = new UILabel();
            appearLabel.Text          = "Show animation:";
            appearLabel.TextColor     = new UIColor(0f, 0f, 0f, 1f);
            appearLabel.Font          = UIFont.SystemFontOfSize(12);
            appearLabel.TextAlignment = UITextAlignment.Center;
            this.View.AddSubview(appearLabel);

            hideLabel               = new UILabel();
            hideLabel.Text          = "Hide animation:";
            hideLabel.TextColor     = new UIColor(0f, 0f, 0f, 1f);
            hideLabel.Font          = UIFont.SystemFontOfSize(12);
            hideLabel.TextAlignment = UITextAlignment.Center;
            this.View.AddSubview(hideLabel);
        }
Exemple #11
0
		public override void ViewDidLoad ()
		{
			AddOption ("Show Alert", Show);

			base.ViewDidLoad ();

			this.listViewDelegate = new ListViewDelegate (this);

			alert = new TKAlert ();
			alert.Title = "Animations";
			alert.Style.BackgroundStyle = TKAlertBackgroundStyle.Blur;
			alert.AddActionWithTitle("Close", (TKAlert al, TKAlertAction action) => true);

			showAnimations = new NSMutableArray ();
			showAnimations.Add (new NSString ("Scale in"));
			showAnimations.Add (new NSString ("Fade in"));
			showAnimations.Add (new NSString ("Slide from left"));
			showAnimations.Add (new NSString ("Slide from top"));
			showAnimations.Add (new NSString ("Slide from right"));
			showAnimations.Add (new NSString ("Slide from bottom"));

			dismissAnimations = new NSMutableArray ();
			dismissAnimations.Add (new NSString ("Scale out"));
			dismissAnimations.Add (new NSString ("Fade out"));
			dismissAnimations.Add (new NSString ("Slide to left"));
			dismissAnimations.Add (new NSString ("Slide to top"));
			dismissAnimations.Add (new NSString ("Slide to right"));
			dismissAnimations.Add (new NSString ("Slide to bottom"));

			appearAnimations = new TKDataSource (showAnimations);
			hideAnimations = new TKDataSource (dismissAnimations);

			appearAnimationsList = new TKListView ();
			appearAnimationsList.WeakDataSource = appearAnimations;
			appearAnimationsList.Delegate = listViewDelegate;
			appearAnimationsList.Tag = 0;
			appearAnimationsList.AutoresizingMask = UIViewAutoresizing.None;
			this.View.AddSubview (appearAnimationsList);

			NSIndexPath selected = NSIndexPath.FromItemSection (3, 0);
			appearAnimationsList.SelectItem (selected, true, UICollectionViewScrollPosition.None);

			hideAnimationsList = new TKListView ();
			hideAnimationsList.WeakDataSource = hideAnimations;
			hideAnimationsList.Tag = 1;
			hideAnimationsList.Delegate = listViewDelegate;
			hideAnimationsList.AutoresizingMask = UIViewAutoresizing.None;
			this.View.AddSubview (hideAnimationsList);

			selected = NSIndexPath.FromItemSection (5, 0);
			hideAnimationsList.SelectItem (selected, true, UICollectionViewScrollPosition.None);

			appearLabel = new UILabel ();
			appearLabel.Text = "Show animation:";
			appearLabel.TextColor = new UIColor (0f, 0f, 0f, 1f);
			appearLabel.Font = UIFont.SystemFontOfSize (12);
			appearLabel.TextAlignment = UITextAlignment.Center;
			this.View.AddSubview (appearLabel);

			hideLabel = new UILabel ();
			hideLabel.Text = "Hide animation:";
			hideLabel.TextColor = new UIColor (0f, 0f, 0f, 1f);
			hideLabel.Font = UIFont.SystemFontOfSize (12);
			hideLabel.TextAlignment = UITextAlignment.Center;
			this.View.AddSubview (hideLabel);
		}
Exemple #12
0
        public override void ViewDidLoad()
        {
            this.AddOption ("YES", "Animate buttons", EnableButtonAnimation);
            this.AddOption ("NO", "Animate buttons", DisableButtonAnimation);

            base.ViewDidLoad ();

            buttonAnimationEnabled = true;
            NSMutableDictionary mails = new NSMutableDictionary ();
            mails.Add (new NSString("Joyce Dean"), new NSString("Sales report for January"));
            mails.Add (new NSString("Joel Robertson"), new NSString("Planned network mainternance"));
            mails.Add (new NSString("Sherman Martin"), new NSString("IT help desk"));
            mails.Add (new NSString("Lela Richardson"), new NSString("Summaries of my interviews with customers"));
            mails.Add (new NSString("Jackie Maldonado"), new NSString("REMAINDER: corporate meeting"));
            mails.Add (new NSString("Kathryn Byrd"), new NSString("Stock options"));
            mails.Add (new NSString("Ervin Powers"), new NSString("Thank you!"));
            mails.Add (new NSString("Leland Warner"), new NSString("Meeting with Jack"));
            mails.Add (new NSString("Nicholas Bowers"), new NSString("Please share these articles"));
            mails.Add (new NSString("Alex Soto"), new NSString("Additional information for Jack"));
            mails.Add (new NSString("Naomi Carson"), new NSString("Miss you!"));
            mails.Add (new NSString("Lela Richardson"), new NSString("Summaries of my interviews with customers"));
            mails.Add (new NSString("Rufus Edwards"), new NSString("Training"));
            mails.Add (new NSString("Kathryn Byrd"), new NSString("Stock options"));
            mails.Add (new NSString("Ian Ellis"), new NSString("Do you like this blog article?"));
            mails.Add (new NSString("Pat Vasquez"), new NSString("The latest UI design"));
            mails.Add (new NSString("Chelsea Burton"), new NSString("Need this article!"));
            mails.Add (new NSString("Karl Bates"), new NSString("Training update"));
            mails.Add (new NSString("Evan Rivera"), new NSString("Safety instructions"));
            mails.Add (new NSString("Tony Lawson"), new NSString("Missed our converstation"));
            mails.Add (new NSString("Wallace Little"), new NSString("Swift is awessome"));
            mails.Add (new NSString("Carrie Tran"), new NSString("Missed conference call with Jack"));
            mails.Add (new NSString("Tyler Washington"), new NSString("HR question"));
            mails.Add (new NSString("Dominick Holloway"), new NSString("Wellcome!"));
            mails.Add (new NSString("Clark Sharp"), new NSString("Important question!"));

            this.dataSource.ItemSource = mails;
            this.dataSource.Settings.ListView.CreateCell(delegate (TKListView listView, NSIndexPath indexPath, NSObject item) {
                TKListViewCell cell = listView.DequeueReusableCell("defaultCell", indexPath) as TKListViewCell;
                if (cell.SwipeBackgroundView.Subviews.Length == 0) {
                    CGSize size = cell.Frame.Size;
                    UIFont font = UIFont.SystemFontOfSize(14);
                    UIButton bMore = new UIButton(new CGRect(size.Width - 180, 0, 60, size.Height));
                    bMore.SetTitle("More", UIControlState.Normal);
                    bMore.BackgroundColor = UIColor.LightGray;
                    bMore.TitleLabel.Font = font;
                    bMore.AddTarget(ButtonTouched, UIControlEvent.TouchUpInside);
                    cell.SwipeBackgroundView.AddSubview(bMore);

                    UIButton bFlag = new UIButton(new CGRect(size.Width - 120, 0, 60, size.Height));
                    bFlag.SetTitle("Flag", UIControlState.Normal);
                    bFlag.BackgroundColor = UIColor.Orange;
                    bFlag.TitleLabel.Font = font;
                    bFlag.AddTarget(ButtonTouched, UIControlEvent.TouchUpInside);
                    cell.SwipeBackgroundView.AddSubview(bFlag);

                    UIButton bTrash = new UIButton(new CGRect(size.Width - 60, 0, 60, size.Height));
                    bTrash.SetTitle("Trash", UIControlState.Normal);
                    bTrash.BackgroundColor = UIColor.Red;
                    bTrash.TitleLabel.Font = font;
                    bTrash.AddTarget(ButtonTouched, UIControlEvent.TouchUpInside);
                    cell.SwipeBackgroundView.AddSubview(bTrash);

                    UIButton bUnread = new UIButton(new CGRect(0, 0, 60, size.Height));
                    bUnread.SetTitle("Mark as Unread", UIControlState.Normal);
                    bUnread.BackgroundColor = UIColor.Blue;
                    bUnread.TitleLabel.Font = font;
                    bUnread.TitleLabel.LineBreakMode = UILineBreakMode.WordWrap;
                    bUnread.TitleLabel.TextAlignment = UITextAlignment.Center;
                    bUnread.AddTarget(ButtonTouched, UIControlEvent.TouchUpInside);
                    cell.SwipeBackgroundView.AddSubview(bUnread);
                }

                return cell;
            });

            this.dataSource.Settings.ListView.InitCell (delegate (TKListView listView, NSIndexPath indexPath, TKListViewCell cell, NSObject item) {
                cell.TextLabel.Text = item as NSString;
                NSDictionary dict = this.dataSource.ItemSource as NSDictionary;
                cell.DetailTextLabel.AttributedText = this.AttributedMailText(dict[item] as NSString);
                cell.ContentInsets = new UIEdgeInsets(5,10,5,10);
            });

            this.listViewDelegate = new ListViewDelegate (this);

            this.listView.Frame = this.View.Bounds;
            this.listView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            this.listView.WeakDataSource = this.dataSource;
            this.listView.Delegate = this.listViewDelegate;
            this.listView.AllowsCellSwipe = true;
            this.listView.CellSwipeLimits = new UIEdgeInsets (0, 60, 0, 180);
            this.listView.CellSwipeTreshold = 30;
            this.View.AddSubview (this.listView);

            TKListViewLinearLayout layout = (TKListViewLinearLayout)this.listView.Layout;
            layout.ItemSize = new CGSize (100, 80);
        }