/// <summary> /// Adds a <see cref="CheckableMenuItem"/> to the end of the <see cref="MenuItemCollection"/>. /// </summary> /// <param name="name">The name of the <see cref="Control"/> to be added to the end of the <see cref="MenuItemCollection"/>.</param> /// <param name="click">The action invoked when the child is clicked.</param> public void AddCheckable(string name, Action <IntPtr> click = null) { if (string.IsNullOrEmpty(name)) { throw new ArgumentNullException(nameof(name)); } if (Owner.IsInvalid) { throw new InvalidHandleException(); } CheckableMenuItem item = new CheckableMenuItem(new SafeControlHandle(Libui.MenuAppendCheckItem(Owner.Handle, name)), name); if (click != null) { item.Clicked += (data) => { if (data != null) { click(data); } }; } base.Add(item); }