public void OnTodoItemClick(object sender, ItemClickEventArgs e) { selectedItem = e.ClickedItem as Todo; selectedItemIndex = TodoViewModel.getInstance().Todos.IndexOf(selectedItem); Frame rootFrame = Window.Current.Content as Frame; Grid.SetColumn(EditFrame, rootFrame.ActualWidth > 720 ? 1 : 0); EditFrame.Visibility = Visibility.Visible; EditPage editPage = EditFrame.Content as EditPage; editPage.UpdateView(e.ClickedItem as Todo); UpdateButtons(); }
private void AddButton_Click(object sender, RoutedEventArgs e) { TodoViewModel.getInstance().Todos.Add(new Todo()); selectedItemIndex = TodoViewModel.getInstance().Todos.Count - 1; selectedItem = TodoViewModel.getInstance().Todos[selectedItemIndex]; ListPage listPage = ListFrame.Content as ListPage; listPage.setSelected(selectedItemIndex); Frame rootFrame = Window.Current.Content as Frame; Grid.SetColumn(EditFrame, rootFrame.ActualWidth > 720 ? 1 : 0); EditFrame.Visibility = Visibility.Visible; EditPage editPage = EditFrame.Content as EditPage; editPage.UpdateView(selectedItem); UpdateButtons(); }