Unplanned
Last Updated: 30 Mar 2016 13:59 by ADMIN
ADMIN
George
Created on: 23 Jul 2014 11:45
Category: UI Framework
Type: Bug Report
2
FIX. RadShortcut - if added to RadMenuItem which is in a context menu the Click event of the item is always fired, even if the form is not active
To reproduce:

Add a RadShortcut to a RadMenuItem which is in a context menu:

RadContextMenu m = new RadContextMenu();

RadGridView grid = new RadGridView
{
    Parent = this,
    Dock = DockStyle.Fill
};

RadContextMenuManager mm = new RadContextMenuManager();
mm.SetRadContextMenu(grid, m);

RadMenuItem rtsmNew = new RadMenuItem("New");
rtsmNew.Click += rtsmNew_Click;

RadShortcut rs = new RadShortcut(Keys.None, Keys.F2);
rtsmNew.Shortcuts.Add(rs);
rtsmNew.HintText = rs.GetDisplayText();

m.Items.Add(rtsmNew);

..

private void rtsmNew_Click(object sender, EventArgs e)
{
        new Form().ShowDialog();
}



Workaround:

Check whether the context menu is visible before showing the form:

private void rtsmNew_Click(object sender, EventArgs e)
{
    RadMenuItem item = sender as RadMenuItem;
    if (item.ElementTree.Control.Visible)
    {
        (item.ElementTree.Control as RadContextMenuDropDown).ClosePopup(RadPopupCloseReason.CloseCalled);
        new Form().ShowDialog();
    }
}

0 comments