public void HandleDelete(bool notifyParent) { // first, delete all our child controls int i = 0; for (i = ChildControls.Count - 1; i >= 0; i--) { // since we DO support child controls that are containers, call HandleDelete on all our children IEditableUIControl editableControl = ChildControls[i] as IEditableUIControl; if (editableControl != null) { // let them know not to inform their parent, since that's us. editableControl.HandleDelete(false); } else { // if it's not editable, we need to remove it ourselves ChildControls[i].RemoveFromView(ParentEditingCanvas); } ChildControls.Remove(ChildControls[i]); } // clean ourselves up RemoveFromView(ParentEditingCanvas); // notify our parent if we need to if (notifyParent) { ParentNote.HandleChildDeleted(this); } }
public void HandleDeleteControl(IEditableUIControl control) { // notify the control to delete itself. if this results in a // direct child of ours being deleted, we'll receive a HandleChildDeleted call control.HandleDelete(true); }