RadContextMenu Does not Close after Displaying Dialog Window

Environment

Product Version 2020.2.617
Product RadContextMenu for WPF

Description

RadContextMenu stays open after selecting a menu item and/or opening a dialog window.

Solution

This behavior is observed because of the timing of executing a menu item's command or custom click logic and closing the menu along with the nature of the dialog windows. The custom click logic of the item is executed before the closing of the menu and if a dialog is opened at this point, it freezes the rest of the UI and the menu remains opened.

To resolve this you can use the application's Dispatcher to delay the opening of the dialog as shown in Example 1.

Example 1: Delaying the opening of a dialog window

private void RadContextMenu_ItemClick(object sender, Telerik.Windows.RadRoutedEventArgs e) 
{ 
    Dispatcher.BeginInvoke(new Action(() => 
    { 
        MessageBox.Show("Command Executed!"); 
    })); 
} 

See Also

In this article
Not finding the help you need? Improve this article