This is a migrated thread and some comments may be shown as answers.

RadContextMenu not closing after click

12 Answers 444 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Paresh Hirapara
Top achievements
Rank 1
Paresh Hirapara asked on 17 Apr 2011, 07:41 PM
We are using RadContextMenu inside WPF RadGridview. We have few menu items. When i click on a menuitem we do some processing. 

It is not closing after click. Do i have to close it manually?

We are using Telerik.Windows.Controls.dll file version 2011.1.315.40.

Thanks
Ram

12 Answers, 1 is accepted

Sort by
0
Konstantina
Telerik team
answered on 19 Apr 2011, 01:51 PM
Hello Paresh,

We are not aware of such issue. Could you please try to reproduce it in a sample project and send it to us. In that way we will be able to track down the source of the problem and provide you with solution.

Looking forward to your reply.

Best wishes,
Konstantina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Mike Henders
Top achievements
Rank 1
answered on 22 Apr 2011, 04:42 PM
I too have just started seeing this problem after installing Q1 2011 SP1.  When I have more information or a sample I will post it here. It is not occurring on all my RadGridView context menus, just some.

Cheers,
Mike
0
Mike Henders
Top achievements
Rank 1
answered on 22 Apr 2011, 05:09 PM
Revision to my previous post. It was a stupid mistake of putting a plain MenuItem in the RadContextMenu instead of a RadMenuItem.  I suspect this didn't work in the previous build either but nobody noticed until testing after upgrading to SP1.

It would be nice if you added a GridContextMenu.Close() method.

Cheers,
Mike
0
Konstantina
Telerik team
answered on 25 Apr 2011, 11:12 AM
Hello Mike,

We are glad that the issue is resolved.

We will consider adding such property if we receive enough clients' requests.

All the best,
Konstantina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Michael Blanchet
Top achievements
Rank 1
answered on 03 Jul 2012, 08:14 PM
There definitely needs to be a close method on the context menu.

The problem arises when you have a menu item that takes you through a progression of states. If the user accidently presses the mouse button twice, without a menu close mechanism, two events will be triggered instead of one.

This is a significant issue.  Using Q2 2012
0
Konstantina
Telerik team
answered on 06 Jul 2012, 01:05 PM
Hello,

I have logged this feature request in PITS, where you could vote for it and track its status. The more votes it receives the sooner it will be implemented.

Kind regards,
Konstantina
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Chuck
Top achievements
Rank 1
answered on 09 May 2014, 06:36 PM
I found this to work for a class that inherits from RadContextMenu:

this.IsOpen = false;

I'd added a textbox and a button to the control and needed to close the context menu when the button was pressed.

This is my full button click event if it helps anyone:

void ButtonSet_Click(object sender, RoutedEventArgs e)
{
    Button b = (Button)sender;
    StackPanel stack = b.GetVisualParent<StackPanel>();
    TextBox tb = stack.ChildrenOfType<TextBox>().First();
    int value;
    if (int.TryParse(tb.Text, out value))
    {
        ... code to process int ...
        this.IsOpen = false;
    }
}

0
Rosen Vladimirov
Telerik team
answered on 10 May 2014, 05:37 AM
Hi Chuck,

RadContextMenu will be closed when you click outside of it or when you click on one of its RadMenuItems. If you have added a button inside RadMenuItem, when you click it, you have to manually close RadContextMenu by setting its IsOpen property to false, as you have mentioned in your post.

Hope this helps. Feel free to contact us in case you have any problems or concerns.

Regards,
Rosen Vladimirov
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Kevin
Top achievements
Rank 1
answered on 19 Apr 2018, 03:41 PM

Hi, I am having an opposite issue where I want to force RadContextMenu to stay open. I am attempting to implement DragDropManager to allow users to reorder RadMenuItems as per https://docs.telerik.com/devtools/wpf/controls/dragdropmanager/getting-started .

However, when I begin to drag a RadMenuItem the RadContextMenu closes automatically. I believe this is because setting AllowCapturedDrag to true says that the dragged item will steal mouse capture. Interestingly enough the RadContextMenu.LostMouseCapture event never fires.

My first thought was to subscribe to RadContextMenu.Closing event and set the EventArgs.Handled = true. However, despite having Opening, Opened, and Closed events, a Closing event doesn't exist. Do you have any suggestions for a workaround?

0
Vladimir Stoyanov
Telerik team
answered on 24 Apr 2018, 01:07 PM
Hello Kevin,

Perhaps I am missing something, but in order for the RadContextMenu to stay open after an item has been clicked, you can set its StaysOpen property to "True". Can you give this a try and let me know if it is suitable for your scenario?

Regards,
Vladimir Stoyanov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Kevin
Top achievements
Rank 1
answered on 24 Apr 2018, 07:09 PM

Vladimir, thanks for responding.

I have StaysOpen set to true. However, beginning to drag menu items doesn't count as a click I suppose because the RadContextMenu automatically closes. Essentially once I hold down on a menu item and begin to drag it, the context menu thinks I clicked off the menu and it closes.

0
Vladimir Stoyanov
Telerik team
answered on 27 Apr 2018, 02:39 PM
Hello Paresh,

Thank you for the additional information.

I researched the described scenario some more and you are indeed correct that the dragged item is taking mouse capture. The LostMouseCapture event is not fired since it is handled in the MenuBase class from which the RadContextMenu inherits. That event handler is responsible for closing the menu when the mouse capture is lost. Bearing this in mind I am afraid that it is not possible to reorder the RadContextMenu items using the DragDropManager.

Regards,
Vladimir Stoyanov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
Menu
Asked by
Paresh Hirapara
Top achievements
Rank 1
Answers by
Konstantina
Telerik team
Mike Henders
Top achievements
Rank 1
Michael Blanchet
Top achievements
Rank 1
Chuck
Top achievements
Rank 1
Rosen Vladimirov
Telerik team
Kevin
Top achievements
Rank 1
Vladimir Stoyanov
Telerik team
Share this question
or