How to close RadMenu when some object inside a RadMenuItem is clicked...

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

    Posted 26 Jul 2010 Link to this post

    Let's say I have RadMenu that has an ItemTemplate defined like this...

    <Rad:HierarchicalDataTemplate x:Key="it">
          <RowDefinition Height="21" />
          <ColumnDefinition Width="1*"/>
        <StackPanel Orientation="Horizontal">
          <TextBlock Content="{Binding MyCaption}" />
          <Button Content="Button1" Command="..." CommandParameter="..." />
          <Button Content="Button2" Command="..." CommandParameter="..." />

    The RadMenuItem's will have a textblock followed by two buttons.  I can click on the RadMenuItem and the RadMenu will behave normally, however, if I click on the buttons, I would also like the RadMenu to close.  How can I accomplish this?

  2. troy
    troy avatar
    20 posts
    Member since:
    Jun 2008

    Posted 28 Jul 2010 Link to this post

    this is the only way I found to accomplish it... this is basically just invoking the default behavior of the root menu item... which happens to be close if it's open.  hope it helps.




    void btn_Click(object sender, RoutedEventArgs e)
    RadMenuItemAutomationPeer mip = new RadMenuItemAutomationPeer(menuItemRoot);


  3. Rob
    Rob avatar
    238 posts
    Member since:
    Jan 2009

    Posted 29 Jul 2010 Link to this post

    I ended up just rearranging my menu items instead.  I'm wary about having to add click events all over just to close the menu.
Back to Top