void addNewItem(object sender, EventArgs e) { Console.WriteLine("BtnAdd pressed"); BNRItem newItem = BNRItemStore.CreateItem(); // int lastRow = BNRItemStore.allItems.IndexOf(newItem); // // NSIndexPath ip = NSIndexPath.FromRowSection(lastRow, 0); // // NSIndexPath[] indexPaths = new NSIndexPath[] {ip}; // TableView.InsertRows(indexPaths, UITableViewRowAnimation.Automatic); DetailViewController detailViewController = new DetailViewController(true); detailViewController.EdgesForExtendedLayout = UIRectEdge.None; detailViewController.Item = newItem; UINavigationController navController = new UINavigationController(detailViewController); navController.ModalPresentationStyle = UIModalPresentationStyle.FormSheet; navController.ModalTransitionStyle = UIModalTransitionStyle.FlipHorizontal; this.PresentViewController(navController, true, null); Console.WriteLine("allItems: {0}, tableViewRows: {1}", BNRItemStore.allItems.Count, TableView.NumberOfRowsInSection(0)); }
public override void RowSelected(UITableView tableView, NSIndexPath indexPath) { // Make a detail view controller DetailViewController detailViewController = new DetailViewController(false); detailViewController.EdgesForExtendedLayout = UIRectEdge.None; // Get the selected BNRItem var items = BNRItemStore.allItems; BNRItem selectedItem = items[indexPath.Row]; // Give the detailViewController a pointer to the item object in row detailViewController.Item = selectedItem; // Push it onto the top of the navigation controller's stack this.NavigationController.PushViewController(detailViewController, true); }