public ActivityPage(Activity act) { theAct = act; Title = act.FullName; fullDescription = string.Format ("{0}, worth {1} points", act.FullName, act.Score); Label subTitle = new Label () { FontAttributes = FontAttributes.Italic, HorizontalOptions = LayoutOptions.CenterAndExpand, }; if (act.OneTimeOnly) { subTitle.Text = string.Format ("Worth {0} points (one time only)", act.Score); } else { subTitle.Text = string.Format ("Worth {0} points (each)", act.Score); } var listTemplate = new DataTemplate (() => { var cell = new TextCell (); cell.SetBinding<Task> (TextCell.TextProperty, t => t.DT); cell.SetBinding<Task> (TextCell.DetailProperty, t => t.Notes); return cell; }); // There might be multiple task-completions here, so use a scrolling ListView listCurrentTasks = new ListView (); listCurrentTasks.ItemTemplate = listTemplate; listCurrentTasks.ItemSelected += HandleSelect; // There might be multiple task-completions here, so use a scrolling ListView listTaskHistory = new ListView (); listTaskHistory.ItemTemplate = listTemplate; listTaskHistory.ItemSelected += HandleSelect; btnAdd = new Button () { Text = "Tap to Record Completion", BorderWidth = 2, }; btnAdd.Clicked += HandleAdd; var layout = new StackLayout (); layout.Children.Add (subTitle); layout.Children.Add (btnAdd); tapToDeleteOrUpdate = new Label { Text = "Tap below to Delete or Add Notes", TextColor = Color.Teal, }; tapToDeleteOrUpdate.IsVisible = false; layout.Children.Add (tapToDeleteOrUpdate); layout.Children.Add (listCurrentTasks); var lineSeparator = new BoxView () { Color = Color.Blue, WidthRequest = 100, HeightRequest = 8 }; layout.Children.Add (lineSeparator); layout.Children.Add (new Label { Text = "History (not included in current score):", TextColor = Color.Teal, }); layout.Children.Add (listTaskHistory); //layout.HorizontalOptions = LayoutOptions.Center; Content = layout; }
public ActivityPage(Activity act) { theAct = act; Title = act.FullName; fullDescription = string.Format("{0}, worth {1} points", act.FullName, act.Score); Label subTitle = new Label() { FontAttributes = FontAttributes.Italic, HorizontalOptions = LayoutOptions.CenterAndExpand, }; if (act.OneTimeOnly) { subTitle.Text = string.Format("Worth {0} points (one time only)", act.Score); } else { subTitle.Text = string.Format("Worth {0} points (each)", act.Score); } var listTemplate = new DataTemplate(() => { var cell = new TextCell(); cell.SetBinding <Task> (TextCell.TextProperty, t => t.DT); cell.SetBinding <Task> (TextCell.DetailProperty, t => t.Notes); return(cell); }); // There might be multiple task-completions here, so use a scrolling ListView listCurrentTasks = new ListView(); listCurrentTasks.ItemTemplate = listTemplate; listCurrentTasks.ItemSelected += HandleSelect; // There might be multiple task-completions here, so use a scrolling ListView listTaskHistory = new ListView(); listTaskHistory.ItemTemplate = listTemplate; listTaskHistory.ItemSelected += HandleSelect; btnAdd = new Button() { Text = "Tap to Record Completion", BorderWidth = 2, }; btnAdd.Clicked += HandleAdd; var layout = new StackLayout(); layout.Children.Add(subTitle); layout.Children.Add(btnAdd); tapToDeleteOrUpdate = new Label { Text = "Tap below to Delete or Add Notes", TextColor = Color.Teal, }; tapToDeleteOrUpdate.IsVisible = false; layout.Children.Add(tapToDeleteOrUpdate); layout.Children.Add(listCurrentTasks); var lineSeparator = new BoxView() { Color = Color.Blue, WidthRequest = 100, HeightRequest = 8 }; layout.Children.Add(lineSeparator); layout.Children.Add(new Label { Text = "History (not included in current score):", TextColor = Color.Teal, }); layout.Children.Add(listTaskHistory); //layout.HorizontalOptions = LayoutOptions.Center; Content = layout; }