StackLayout TasksLayout() { var layout = new StackLayout (); var listView = new ListView (); var listSource = new List<TaskViewItem> (); listView.ItemTemplate = new DataTemplate (typeof(TaskListTemplate)); layout.Padding = AppSettings.LayoutPadding; var items = _db.GetTasks ().ToArray(); for (var i = 0; i < items.Length; i++) { var nextTaskLocked = i + 1 == items.Length || items [i + 1].Locked; var taskViewItem = new TaskViewItem (items [i], nextTaskLocked); listSource.Add (taskViewItem); } listView.ItemTapped += ListView_ItemTapped; listView.ItemsSource = listSource; layout.Children.Add (listView); return layout; }
StackLayout TasksLayout() { var layout = new StackLayout(); var listView = new ListView(); var listSource = new List <TaskViewItem> (); listView.ItemTemplate = new DataTemplate(typeof(TaskListTemplate)); layout.Padding = AppSettings.LayoutPadding; var items = _db.GetTasks().ToArray(); for (var i = 0; i < items.Length; i++) { var nextTaskLocked = i + 1 == items.Length || items [i + 1].Locked; var taskViewItem = new TaskViewItem(items [i], nextTaskLocked); listSource.Add(taskViewItem); } listView.ItemTapped += ListView_ItemTapped; listView.ItemsSource = listSource; layout.Children.Add(listView); return(layout); }