Hide ContextMenu on Click

3 posts, 0 answers
  1. Andreas
    Andreas avatar
    36 posts
    Member since:
    Sep 2008

    Posted 25 May 2010 Link to this post

    Hi,

    I'am having a RadSplitButton with a RadContextMenu as DropDownContent:
      <telerik:RadSplitButton x:Name="BtnSplit" Width="100" Height="25" IsToggle="True" Margin="20"
                    <telerik:RadSplitButton.DropDownContent> 
                        <telerikNavigation:RadContextMenu> 
                            <telerikNavigation:RadMenuItem Header="TestItem" Click="MenuItem_Click" /> 
                        </telerikNavigation:RadContextMenu> 
                    </telerik:RadSplitButton.DropDownContent> 
                </telerik:RadSplitButton> 

    In the event handler I simply open a message box.
            public void MenuItem_Click(object sender, RoutedEventArgs e) 
            { 
                MessageBox.Show("Test"); 
            } 

    The problem is, that after a click on the menu item the context menu stays open. But shouldn't it close automatically? What am I missing?

    Thanks, Stefan


  2. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 25 May 2010 Link to this post

    Hi Stefan,

    You need to set BtnSplit.IsOpen = false;in the MenuItem_Click() event handler:
    private void MenuItem_Click(object sender, RadRoutedEventArgs e)
    {
        BtnSplit.IsOpen = false;
        MessageBox.Show("Test"); 
    }
    Give this a try and let me know if it works for you.

    Greetings,
    Tina Stancheva
    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. Andreas
    Andreas avatar
    36 posts
    Member since:
    Sep 2008

    Posted 26 May 2010 Link to this post

    Hi Tina,

    worked great. Thanks for your fast answer.

    Stefan
Back to Top