Find file
Fetching contributors…
Cannot retrieve contributors at this time
43 lines (37 sloc) 1.17 KB
using System;
using System.Collections.Generic;
using System.IO;
using Foundation;
using UIKit;
namespace StoryboardTables {
public class RootTableSource : UITableViewSource {
// ##
// there is NO database or storage of Tasks in this example, just an in-memory List<>
// refer to the other Tasky samples on github for an implementation using SQLite-NET
// ##
Task[] tableItems;
string cellIdentifier = "taskcell";
public RootTableSource (Task[] items)
tableItems = items;
public override nint RowsInSection (UITableView tableview, nint section)
return tableItems.Length;
public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath)
// in a Storyboard, Dequeue will ALWAYS return a cell,
UITableViewCell cell = tableView.DequeueReusableCell (cellIdentifier);
cell.TextLabel.Text = tableItems[indexPath.Row].Name;
if (tableItems[indexPath.Row].Done)
cell.Accessory = UITableViewCellAccessory.Checkmark;
cell.Accessory = UITableViewCellAccessory.None;
return cell;
public Task GetItem(int id) {
return tableItems[id];