How to collapse RadContextMenu when RadMenuItem doesn't receive click?

3 posts, 1 answers
  1. Rob
    Rob avatar
    238 posts
    Member since:
    Jan 2009

    Posted 30 Jun 2010 Link to this post

    I am working on a control that is basically a dropdown with a popup content area...  The attached picture can explain it better than I can here. 

    I have started using ToggleButton with a RadContextMenu and it seems to work well.  I think my ultimate goal would be to simply have a giant ContentPresenter in the popup instead of using a RadContextMenu...  Until I figure that out, I can hack each RadMenuItem using a TemplateSelector and choose a different appearance for each one that will get me closer to my goal...

    That being said, I have one problem.  How can I "close" the popup when something other than the RadMenuItem receives the click event... for example if I click the Button "option 1"?  The context menu works fine if I click the RadMenuItem itself.
  2. Answer
    Hristo
    Admin
    Hristo avatar
    832 posts

    Posted 02 Jul 2010 Link to this post

    Hi Rob,

    Button control handles MouseLeftButton Up/Down events. That is why RadMenuItem does not receive them and didn't close.
    There is no easy and clean way to handle this situation. Change the Button to some other control that doesn't handle Up/Down events and RadContextMenu will close.

    I hope this will help you.

    Sincerely yours,
    Hristo
    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. DevCraft banner
  4. troy
    troy avatar
    20 posts
    Member since:
    Jun 2008

    Posted 28 Jul 2010 Link to this post

    I figured out how to accomplish basically the same thing with this...

    Troy

     

     

     

    void btnclose_Click(object sender, RoutedEventArgs e)

     

    {

     

     

    RadContextMenu cm = (RadContextMenu)((Button)sender).Parent;

     

    cm.IsOpen =

     

    false;

     

    }

Back to Top