Beispiel #1
0
        public ContactsViewController()
        {
            Title = "Contacts";
            var items = Database.Contacts.Table <Person> ();

            TableView.Source = DataSource = new ViewModelDataSource <Person> {
                CellForItem = (tv, item) => {
                    var cell = tv.DequeueReusableCell <ContactCell>(ContactCell.Key);
                    cell.Contact = item;
                    return(cell);
                },
                ViewModel = (viewModel = new EnumerableViewModel <Person> {
                    Items = items,
                }),
            };
        }
Beispiel #2
0
        public ContactsViewController()
        {
            Title = "Contacts";

            // TODO: Step 1 Add .ToList() to force this to evaluate and cache off to a list.
            var items = Database.Contacts.Table <Person> ().ToList();

            TableView.Source = DataSource = new ViewModelDataSource <Person> {
                CellForItem = (tv, item) => {
                    var cell = tv.DequeueReusableCell <ContactCell>(ContactCell.Key);
                    cell.Contact = item;
                    return(cell);
                },
                ViewModel = (viewModel = new EnumerableViewModel <Person> {
                    Items = items,
                }),
            };
        }