public virtual void Clear() { MenuTracker tracker = owner.Tracker; foreach (MenuItem item in items) { if (tracker != null) { tracker.RemoveShortcuts(item); } item.parent_menu = null; } items.Clear(); owner.OnMenuChanged(EventArgs.Empty); }
public virtual void RemoveAt(int index) { if (index < 0 || index >= Count) { throw new ArgumentOutOfRangeException("Index of out range"); } MenuItem item = (MenuItem)items [index]; MenuTracker tracker = owner.Tracker; if (tracker != null) { tracker.RemoveShortcuts(item); } item.parent_menu = null; items.RemoveAt(index); UpdateItemsIndices(); owner.OnMenuChanged(EventArgs.Empty); }