This is a migrated thread and some comments may be shown as answers.

Hide ContextMenu on Click

2 Answers 110 Views
Buttons
This is a migrated thread and some comments may be shown as answers.
Andreas
Top achievements
Rank 1
Andreas asked on 25 May 2010, 02:30 PM
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 Answers, 1 is accepted

Sort by
0
Tina Stancheva
Telerik team
answered on 25 May 2010, 06:52 PM
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.
0
Andreas
Top achievements
Rank 1
answered on 26 May 2010, 07:57 AM
Hi Tina,

worked great. Thanks for your fast answer.

Stefan
Tags
Buttons
Asked by
Andreas
Top achievements
Rank 1
Answers by
Tina Stancheva
Telerik team
Andreas
Top achievements
Rank 1
Share this question
or