Ejemplo n.º 1
0
        public override void CommitEditingStyle(UITableView tableView, UITableViewCellEditingStyle editingStyle, NSIndexPath indexPath)
        {
            switch (editingStyle)
            {
            case UITableViewCellEditingStyle.Delete:
                // remove the item from the underlying data source
                owner.DeleteItem(tableItems[indexPath.Row]);
                tableItems.RemoveAt(indexPath.Row);
                // delete the row from the table
                tableView.DeleteRows(new NSIndexPath[] { indexPath }, UITableViewRowAnimation.Fade);
                break;

            case UITableViewCellEditingStyle.Insert:
                //---- create a new item and add it to our underlying data
                var newItem = new VTSModel();
                newItem.VacationType = "inserted";
                tableItems.Insert(indexPath.Row, newItem);
                //---- insert a new row in the table
                tableView.InsertRows(new NSIndexPath[] { indexPath }, UITableViewRowAnimation.Fade);
                break;

            case UITableViewCellEditingStyle.None:
                Console.WriteLine("CommitEditingStyle:None called");
                break;
            }
        }