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

setting IsOpen=true makes RadContextMenu staying opened

1 Answer 119 Views
ContextMenu
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 24 Nov 2012, 02:01 PM
<Rectangle Stroke="Black" StrokeThickness="1" Fill="#DADADA" Height="8" Width="8">
     <Rectangle.Triggers>
       <EventTrigger RoutedEvent="MouseLeftButtonDown">
         <BeginStoryboard>
           <Storyboard>
             <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="IsOpen" Storyboard.Target="{x:Reference ContextMenu}">
               <DiscreteObjectKeyFrame>
                 <DiscreteObjectKeyFrame.Value>
                   <sys:Boolean>True</sys:Boolean>
                 </DiscreteObjectKeyFrame.Value>
               </DiscreteObjectKeyFrame>
             </ObjectAnimationUsingKeyFrames>
           </Storyboard>
         </BeginStoryboard>
       </EventTrigger>
     </Rectangle.Triggers>
     <telerik:RadContextMenu.ContextMenu>
       <telerik:RadContextMenu x:Name="ContextMenu" ShowDelay="0">
         <telerik:RadMenuItem Header="Reset value" />
         <telerik:RadMenuItem Header="Set binding" />
       </telerik:RadContextMenu>
     </telerik:RadContextMenu.ContextMenu>
   </Rectangle>

Click on the rectangle, then click somewhere else and radcontextmenu stays opened.  This way you can open multiple contexmenus simultaneously

This does not happen with regular contextmenu.

1 Answer, 1 is accepted

Sort by
0
Accepted
Rosen Vladimirov
Telerik team
answered on 26 Nov 2012, 03:59 PM
Hello Daniel,

We'll check what is causing this behavior, but meanwhile I would suggest you to check this article which is describing how to open RadContextMenu on a specific event. In your case the code will look like this:
<Rectangle Stroke="Black" StrokeThickness="1" Fill="#DADADA" Height="8" Width="8">
    <telerik:RadContextMenu.ContextMenu>
        <telerik:RadContextMenu x:Name="ContextMenu" EventName="MouseLeftButtonDown">
            <telerik:RadMenuItem Header="Reset value" />
            <telerik:RadMenuItem Header="Set binding" />
        </telerik:RadContextMenu>
    </telerik:RadContextMenu.ContextMenu>
</Rectangle>

If you use it this way, RadContextMenu will open only on MouseLeftButtonDown event and it will work as you expect.

Hopefully this helps.

Kind regards,
Rosen Vladimirov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
ContextMenu
Asked by
Daniel
Top achievements
Rank 1
Answers by
Rosen Vladimirov
Telerik team
Share this question
or