Keep the ContextMenu open after MenuItem has been clicked?

4 posts, 0 answers
  1. Thomas Roithmeier
    Thomas Roithmeier avatar
    17 posts
    Member since:
    Jul 2010

    Posted 24 Oct 2010 Link to this post

    I've adapted the ContextMenu sample from the sample application where you can set the Visibility for each Column of a RadGridView for my application.
    Now it would be nice if the ContextMenu stays open and the user can set the Visiblity of all columns without having to right-click on the header for each single column he wants to show or hide and if the ContextMenu closes when you click outside of it.

    Is there a way to do that with RadContextMenu?

    Thx

  2. Hristo
    Admin
    Hristo avatar
    832 posts

    Posted 25 Oct 2010 Link to this post

    Hi Thomas Roithmeier,

    RadMenuItem have StaysOpen property. If you set it to true then menuItem will keep the menu open (unless you click outside the menu). You can set it to all items that have to keep the menu open or you can use implicit style (without x:Key) and set it in the style so that it will apply to all menu items.
    Here is a simple example:
    <telerik:RadContextMenu>
       <telerik:RadMenuItem Header="Stays Open" StaysOpenOnClick="True" />
       <telerik:RadMenuItem Header="Close On Click" />
       <telerik:RadMenuItem Header="Stays Open" StaysOpenOnClick="True" />
    </telerik:RadContextMenu>

    Let us know if you need more information.

    Regards,
    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. UI for WPF is Visual Studio 2017 Ready
  4. Maximilian
    Maximilian avatar
    1 posts
    Member since:
    Dec 2015

    Posted 27 Jan Link to this post

    Hello,

    though this post is quite old I hope to get help. Basically I want to do the same as the OP. I've tried to keep my RadContextMenu of one of my RadRibbonSplitButtons open so that the user can check several RadMenuItems at once without having to open the menu each time. I tried to achieve this by setting the RadContextMenu's StaysOpen property to True, by setting the StaysOpenOnClick property of the respective RadMenuItems to True and by setting the RadRibbonSplitButton's KeepOpen property to True. However, neither of those did work... Can you please help me?

    Here's my XAML:

    <telerik:RadRibbonSplitButton Size="Large"
                                  Text="Start/Stop"
                                  LargeImage="../Images/SceneStartStopp32.png"
                                  SmallImage="../Images/SceneStartStopp16.png">
        <telerik:RadRibbonSplitButton.DropDownContent>
            <telerik:RadContextMenu StaysOpen="True">
                <telerik:RadMenuGroupItem Header="Start- und Stopverhalten">
                    <telerik:RadMenuItem Name="MenuItemDoNotStop"
                                         IsCheckable="True"
                                         IsChecked="False"
                                         Header="Nicht stoppen"
                                         Checked="RadMenuItem_OnChecked"/>
                    <telerik:RadMenuItem Name="MenuItemStartStopSimultaneously"
                                         IsCheckable="True"
                                         IsChecked="True"
                                         Header="Start und Stop gleichzeitig"
                                         Checked="RadMenuItem_OnChecked"/>
                    <telerik:RadMenuItem Name="MenuItemFirstStartThenStop"
                                         IsCheckable="True"
                                         IsChecked="False"
                                         Header="Erst Start, dann Stop"
                                         Checked="RadMenuItem_OnChecked"/>
                </telerik:RadMenuGroupItem>
                <telerik:RadMenuGroupItem Header="Vor- und Nachlaufzeit">
                    <telerik:RadMenuItem Name="MenuItemStartWithLeadTime"
                                         IsCheckable="True"
                                         IsChecked="False">
                        <telerik:RadMenuItem.Header>
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="Auto"/>
                                </Grid.ColumnDefinitions>
                                <TextBlock Grid.Column="0"
                                           Text="Start mit Vorlaufzeit"
                                           VerticalAlignment="Center"
                                           Margin="0,0,10,0"/>
                                <telerik:RadNumericUpDown Grid.Column="1">
                                </telerik:RadNumericUpDown>
                            </Grid>
                        </telerik:RadMenuItem.Header>
                    </telerik:RadMenuItem>
                </telerik:RadMenuGroupItem>
            </telerik:RadContextMenu>
        </telerik:RadRibbonSplitButton.DropDownContent>
    </telerik:RadRibbonSplitButton>

  5. Polya
    Admin
    Polya avatar
    200 posts

    Posted 01 Feb Link to this post

    Hello Maximilian,

    This behavior is caused by the built in auto-closing popup mechanism of the RadRibonSplitButton which cannot be disabled.
    That said, we suggest using the RadSplitButton instead which doesn't have the mentioned above behavior and will allow for the RadContextMenu to stay open when the StaysOpenOnClick = "true".

    Hope this helps.

    Regards,
    Polya
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
Back to Top