void item_CheckedChanged(NValueChangeEventArgs arg) { bool isChecked = (bool)arg.NewValue; if (isChecked == false) { return; } NCheckableMenuItem item = (NCheckableMenuItem)arg.TargetNode; NMenuItemCollection items = item.ParentNode as NMenuItemCollection; for (int i = 0, count = items.Count; i < count; i++) { NCheckableMenuItem currentItem = items[i] as NCheckableMenuItem; if (currentItem == null) { continue; } if (currentItem != item && currentItem.Checked) { // We've found the previously checked item, so uncheck it currentItem.Checked = false; break; } } }
void item_CheckedChanging(NValueChangeEventArgs arg) { bool isChecked = (bool)arg.NewValue; if (isChecked) { return; } // Make sure the user is not trying to uncheck the checked item NCheckableMenuItem item = (NCheckableMenuItem)arg.TargetNode; NMenuItemCollection items = item.ParentNode as NMenuItemCollection; for (int i = 0, count = items.Count; i < count; i++) { NCheckableMenuItem currentItem = items[i] as NCheckableMenuItem; if (currentItem == null) { continue; } if (currentItem != item && currentItem.Checked) { return; } } arg.Cancel = true; }
protected override void AddItems(NMenuItemCollection items) { // Add the "Add Appointment" menu item items.Add(CreateMenuItem(Nevron.Nov.Schedule.NResources.Image_Edit_AddAppointment_png, NScheduleView.AddAppointmentCommand)); // Add the custom command menu item items.Add(CreateMenuItem(NResources.Image_Ribbon_16x16_smiley_png, CustomCommand)); }
protected override void AddItems(NMenuItemCollection items) { // Add the "Copy" menu item items.Add(CreateMenuItem(Nevron.Nov.Presentation.NResources.Image_Edit_Copy_png, NDrawingView.CopyCommand)); // Add the custom command menu item items.Add(CreateMenuItem(NResources.Image_Ribbon_16x16_smiley_png, CustomCommand)); }