Use attached to reproduce!
Provide information about the clicked control in the arguments of RadContextMenu DropDownOpening/ed event. This will help easily determine which control is clicked in case the same RadContextMenu is associated with more than one control.
To reproduce: Open a WinForms project. Add a RadMenu and add a File menu item. Add a Search Item to the File menu Add an imagelist with images. Drop the File Menu and select the Search menu item Make sure the Search menuItem is selected in the property grid Try to assign an imageIndex to the search MenuItem. You can't Workaround: restart Visual Studio and try again to assign the ImageIndex.
When you open the drop down with menu items and hover a certain item, it is selected and orange fill is applied. Try to navigate with up/down arrow keys. The respective item will be selected. However, the hovered item still remains orange. It is not correct. In MS Word for example only one item is highlighted(selected) at a time.
To reproduce - Set the item text like this: this.radMenuItem3.Text = "&Пункт меню"; Workaround: class Item : RadMenuItem { protected override RadDropDownMenu CreateDropDownMenu() { return new MyDropDownMenu(this); } protected override Type ThemeEffectiveType { get { return typeof(RadMenuItem); } } } class MyDropDownMenu : RadDropDownMenu { public MyDropDownMenu(RadMenuItem owner) : base(owner) { } protected override bool ProcessMnemonic(Keys keyData) { var charKey = VirtualKeyCodeToUnicode(keyData); List<RadItem> mnemonicItems = new List<RadItem>(); int selectedIndex = -1; RadItem selectedItem = this.GetSelectedItem(); foreach (RadItem menuItem in this.Items) { if (IsMnemonic(charKey[0], menuItem.Text) && menuItem.Enabled && menuItem.Visibility == ElementVisibility.Visible) { mnemonicItems.Add(menuItem); if (selectedItem == menuItem) { selectedIndex = mnemonicItems.Count - 1; } } } if (mnemonicItems.Count == 1) { mnemonicItems[0].Select(); mnemonicItems[0].PerformClick(); return true; } else if (mnemonicItems.Count > 0) { selectedIndex = (selectedIndex + 1) % mnemonicItems.Count; mnemonicItems[selectedIndex].Focus(); this.SelectItem(mnemonicItems[selectedIndex]); return true; } return false; //return base.ProcessMnemonic(keyData); } public string VirtualKeyCodeToUnicode(Keys key) { uint virtualKeyCode = (uint) key; StringBuilder result = new StringBuilder(); byte[] keyboardState = new byte[255]; bool keyboardStateStatus = GetKeyboardState(keyboardState); if (!keyboardStateStatus) { return ""; } uint scanCode = MapVirtualKey(virtualKeyCode, 0); IntPtr inputLocaleIdentifier = GetKeyboardLayout(0); ToUnicodeEx(virtualKeyCode, scanCode, keyboardState, result, (int) 5, (uint) 0, inputLocaleIdentifier); return result.ToString(); } [DllImport("user32.dll")] static extern bool GetKeyboardState(byte[] lpKeyState); [DllImport("user32.dll")] static extern uint MapVirtualKey(uint uCode, uint uMapType); [DllImport("user32.dll")] static extern IntPtr GetKeyboardLayout(uint idThread); [DllImport("user32.dll")] static extern int ToUnicodeEx(uint wVirtKey, uint wScanCode, byte[] lpKeyState, [Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder pwszBuff, int cchBuff, uint wFlags, IntPtr dwhkl); }
RadContextMenu items are not copied when the context menu is copied.
To reproduce: RadMenuItem item = new RadMenuItem(); item.Text = "Item1"; RadMenuComboItem comboItem = new RadMenuComboItem(); comboItem.ComboBoxElement.DropDownStyle = RadDropDownStyle.DropDownList; comboItem.Items.Add("meters"); comboItem.Items.Add("feet"); item.Items.Add(comboItem); this.radApplicationMenu1.Items.Add(item); The undesired behavior is illustrated better in the attached file. Workaround: item.DropDownClosing += item_DropDownClosing; comboItem.ComboBoxElement.EditableElement.MouseDown += EditableElement_MouseDown; comboItem.ComboBoxElement.EditableElement.MouseUp += EditableElement_MouseUp; bool shouldCancel = false; private void EditableElement_MouseUp(object sender, MouseEventArgs e) { shouldCancel = false; } private void EditableElement_MouseDown(object sender, MouseEventArgs e) { shouldCancel = true; } private void item_DropDownClosing(object sender, RadPopupClosingEventArgs args) { args.Cancel = shouldCancel; } private void ComboBoxElement_SelectedIndexChanged(object sender, PositionChangedEventArgs e) { RadDropDownListElement ddle = sender as RadDropDownListElement; if (ddle != null && e.Position < ddle.Items.Count) { RadMessageBox.Show(ddle.Items[e.Position].Text); } }
Workaround: set the TextImageRelation property of the items to ImageBeforeText, you can also check the attached gif file
Use the attached project to reproduce. It contains a workaround as well.
How to reproduce: Add a RadContextMenu and an ImageList to a form, then add some images to the image list and set the ImageList property of the context menu to equal the image list object. Add some items and sub items to the context menu. Setting the image index of a sub item is not reflected by the context menu. Workaround: 1. Design time: and the images as resources and set the image property of each item 2. Set the image index of the sub items at runtime
To reproduce: 1. Add a RadMenu with one item which has one child item. 2. Click on "radMenuItem1" then will appear "radMenuItem2 " . - Keep ("radMenuItem2") open and do not click on it - 3. Go out of the form and click on empty area . 4. Return to the menu and just move mouse over the "radMenuItem1" and it will appear "radMenuItem2" and also move the mouse over the "radMenuItem2" and keep it open . ("do not click on menus") 5. Go out of the form and click the Show Desktop button on the bottom right of the screen 6. Now you can see the problem , the menu has not closed Workaround: override the WndProc method in your Form with the following: protected override void WndProc(ref Message m) { if (m.Msg == NativeMethods.WM_SIZE && (int)m.LParam == 0 && (int)m.WParam == 1) { PopupManager.Default.CloseAll(RadPopupCloseReason.AppFocusChange); } base.WndProc(ref m); } if the above does not work, you can try the following: private void Form1_Deactivate(object sender, EventArgs e) { PopupManager.Default.CloseAll(RadPopupCloseReason.AppFocusChange); }
To reproduce: - Add RadMenu with some items to a blank form. - Initialize the menu like this: Me.RadMenu1.RightToLeft = System.Windows.Forms.RightToLeft.Yes Me.RadMenu1.DropDownAnimationEnabled = True Me.RadMenu1.DropDownAnimationFrames = 30 Me.RadMenu1.DropDownAnimationEasing = RadEasingType.OutElastic - Show the item drop down manually : Private Sub RadMenuItem_MouseHover(sender As Object, e As EventArgs) Dim item As RadMenuItem = TryCast(sender, RadMenuItem) If item IsNot Nothing Then item.DropDown.Show() End If End Sub
To reproduce: Add a RadForm as MDI child to another form. Add RadMenu to the child and the main forms. Associate hotkeys as follows: RadMenuItem item = new RadMenuItem; item.Text = "&File"; You will notice that only the main menu can be accessed with the Alt key and the shortcut. Workaround: Subscribe for each childform's KeyUp event and use the following event handler: private void childForm_KeyUp(object sender, KeyEventArgs e) { Form form = sender as Form; if (!form.Focused) { return; } RadMenu menu = null; foreach (Control control in form.Controls) { if (control is RadMenu) { menu = control as RadMenu; break; } } if ((Control.ModifierKeys & Keys.Alt) == Keys.Alt && menu != null) { foreach (RadItem item in menu.Items) { int ampersantIndex = item.Text.IndexOf("&"); if (ampersantIndex != -1) { char hotkeyChar = item.Text[ampersantIndex + 1]; if (char.ToLower(hotkeyChar) == char.ToLower((char)e.KeyValue)) { item.PerformClick(); break; } } } } }
FIX. RadContextMenu/RadMenu - animations does not perform correctly on Windows 8 WORKAROUND Execute ThemeResolutionService.AllowAnimations = false; before the context menu is opened and then Allow animations again when the context menu is closed
Workaround: menu.DropDown.RootElement.Children[0].Children[3].Children[1].Children[2].MaxSize = new Size(0, 400); menu.DropDown.PopupElement.MaxSize = new Size(0, 400);
To reproduce: - Add RadForm with RadMenu with some items - set this.IsMdiContainer = true; - Run and hit the close button -> note the while closing the title bar looses its theme WORKAROUND: radMenu1.IsMainMenu = false;
Workaround: manually add the source menu items to the destination menu by the time of opening the child form and then when you close it, you should put them back.
Steps to reproduce: 1. Add a RadMenu to a form 2. Add menu item with two sub menu items 3. Add a mnemonic to the first one e.g. &First 4. Add a shortcut to the second with the mnemonic letter of the first one e.g. Crtl + F 5. Run the application and open the menu popup, press Ctrl + F and you will see that the second item will be clicked and then the first one will be clicked as well. The reason for this is that RadMenu and the PopupManager are both registered to listen for windows messages. When the popup handles the shortcut the popup receives a message and it handles the mnemonic.
Steps to reproduce: 1. Add a RadMenu to a form 2. Set up the form to be an MDI parent 3. Add a menu item and set its MdiList property to true 4. Add several mdi children and run the project You will see that the menu drop down will have scroll bar(s) Workaround the issue by setting the MinSize property of the last item in the items in the drop down: radMenuItem1.Items[radMenuItem1.Items.Count - 1].MinSize = new System.Drawing.Size(0, radMenuItem1.Items[radMenuItem1.Items.Count - 1].Size.Height + 1);