private void InitializeToolBars() { string addIcon = null; string refreshIcon = null; if (Device.OS == TargetPlatform.WinPhone) { addIcon = "Toolkit.Content/ApplicationBar.Add.png"; refreshIcon = "Toolkit.Content/ApplicationBar.Refresh.png"; } var addToolButton = new ToolbarItem("Add", addIcon, () => { var todoItem = new ToDoItem(); var todoPage = new ToDoItemXaml(); todoPage.BindingContext = todoItem; Navigation.PushAsync(todoPage); }, 0, 0); var refreshToolButton = new ToolbarItem("Refresh", refreshIcon, () => { OnAppearing(); }, 0, 0); ToolbarItems.Add(addToolButton); ToolbarItems.Add(refreshToolButton); }
// Open item page only when the label is clicked. public void OnItemSelected(object sender, SelectedItemChangedEventArgs e) { if (e.SelectedItem != null) { if (!App.TodoManager.CheckBoxClicked) { var todoItem = e.SelectedItem as ToDoItem; var todoPage = new ToDoItemXaml(); todoPage.BindingContext = todoItem; Navigation.PushAsync(todoPage); } else { App.TodoManager.CheckBoxClicked = false; ((ListView)sender).SelectedItem = null; } } }