Two times context menu opening - How to avoid this?

Ribbon for WPF Forum

Posted 15 years ago by Anurodh Ora

We are creating the (Ribbon)context menu dynamically by handling right click event of our custom control. After all menus are created, for displaying we are setting ContextMenu.IsOpen property to true.

For each "right click" event first we clear the context menu items list and then creating new one but some how it first showing previous context menu list and just after that it shows current newly created menu item list. This looks like flickering.

We handled the context menu's "Closed" event where also we are clearing the menu items list but still we are getting flickering.

Please suggest how can we avoid this flicker effect?

Comments (1)

Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA

This probably is not anything specific to our controls, since our context menu inherits the standard WPF ContextMenu. Thus you most likely could reproduce it with a normal ContextMenu.

I would not recommend that you do this in mouse up though. WPF handles the request and display of context menus for you. As long as you have some sort of ContextMenu in a certain FrameworkElement, it will receive a ContextMenuOpening event in which you should be able to customize it before it displays.

Actipro Software Support

The latest build of this product (v24.1.2) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.