RadContextMenu - prevent auto close when clicking item

4 posts, 0 answers
  1. Dzh
    Dzh avatar
    2 posts
    Member since:
    Mar 2014

    Posted 19 Mar 2014 Link to this post

    Hi!

    How to prevent auto close of RadContextMenu when user clicks on item on it? Now, after mouse click on any item, it closes. In WinForms there is ContextMenuStrip.AutoClose property to prevent autoclosing. Is there analogue of the property on Telerik RadContextMenu?

    Thanks,
  2. Dimitar
    Admin
    Dimitar avatar
    1415 posts

    Posted 24 Mar 2014 Link to this post

    Hello Dzh,

    Thank you for writing.

    We do not have such а property, but you can very easily prevent the menu from closing by using the DropDownClosing event:
    void menu_DropDownClosing(object sender, CancelEventArgs e)
    {
        e.Cancel = true;
    }

    I hope this will be useful. Should you have further questions, I would be glad to help.

    Regards,
    Dimitar
    Telerik

    Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

     
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Dzh
    Dzh avatar
    2 posts
    Member since:
    Mar 2014

    Posted 17 Apr 2014 in reply to Dimitar Link to this post

    Thank you! But could you tell me how to close RadContextMenu programmatically, when I click anywhere outside the menu?
  5. Dimitar
    Admin
    Dimitar avatar
    1415 posts

    Posted 17 Apr 2014 Link to this post

    Hi Dzh,

    Thank you for writing back.

    This can be done by just checking if the context menu contains the mouse and cancel the close only if it does:
    void menu_DropDownClosing(object sender, CancelEventArgs e)
    {
      
        if (menu.DropDown.Bounds.Contains(MousePosition))
        {
            e.Cancel = true;
        }
    }

    Please let me know if there is something else I can help you with. 
     
    Regards,
    Dimitar
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top