RadContextMenu not closing after click

13 posts, 0 answers
  1. Paresh Hirapara
    Paresh Hirapara avatar
    5 posts
    Member since:
    Feb 2007

    Posted 17 Apr 2011 Link to this post

    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
  2. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 19 Apr 2011 Link to this post

    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
  3. Mike Henders
    Mike Henders avatar
    11 posts
    Member since:
    May 2006

    Posted 22 Apr 2011 Link to this post

    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
  4. Mike Henders
    Mike Henders avatar
    11 posts
    Member since:
    May 2006

    Posted 22 Apr 2011 Link to this post

    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
  5. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 25 Apr 2011 Link to this post

    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
  6. Michael Blanchet
    Michael Blanchet avatar
    21 posts
    Member since:
    Sep 2009

    Posted 03 Jul 2012 Link to this post

    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
  7. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 06 Jul 2012 Link to this post

    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 >>
  8. Chuck
    Chuck avatar
    9 posts
    Member since:
    Jan 2013

    Posted 09 May 2014 Link to this post

    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;
        }
    }

  9. Rosen Vladimirov
    Admin
    Rosen Vladimirov avatar
    640 posts

    Posted 10 May 2014 Link to this post

    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.
     
  10. Kevin
    Kevin avatar
    2 posts
    Member since:
    Jun 2017

    Posted 19 Apr 2018 Link to this post

    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?

  11. Vladimir Stoyanov
    Admin
    Vladimir Stoyanov avatar
    421 posts

    Posted 24 Apr 2018 Link to this post

    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.
  12. Kevin
    Kevin avatar
    2 posts
    Member since:
    Jun 2017

    Posted 24 Apr 2018 in reply to Vladimir Stoyanov Link to this post

    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.

  13. Vladimir Stoyanov
    Admin
    Vladimir Stoyanov avatar
    421 posts

    Posted 27 Apr 2018 Link to this post

    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.
Back to Top