private void DeleteRows(TreeItem treeItem, UITableView tableView, int selectedItemIndex) { if (treeItem.Childrens != null) { var itemsToRemove = new List<TreeItem> (treeItem.Childrens); var itmesToRemovePath = new List<NSIndexPath> (); int totalDeleteCount = 0; RecursiveDelete (itemsToRemove, itmesToRemovePath, ref totalDeleteCount); _items.RemoveRange (selectedItemIndex + 1, totalDeleteCount); tableView.DeleteRows (itmesToRemovePath.ToArray (), UITableViewRowAnimation.Fade); treeItem.IsExpanded = false; } }
private void InsertRows(TreeItem treeItem, UITableView tableView, int selectedItemIndex) { if (treeItem.Childrens != null) { var itemsToInsert = new List<TreeItem> (treeItem.Childrens); var itemsToInsertPath = new List<NSIndexPath> (); foreach (var item in itemsToInsert) { selectedItemIndex++; _items.Insert (selectedItemIndex, item); itemsToInsertPath.Add (NSIndexPath.FromRowSection (selectedItemIndex, 0)); } tableView.InsertRows (itemsToInsertPath.ToArray (), UITableViewRowAnimation.Bottom); treeItem.IsExpanded = true; } }