When user right clicks on ContentPane header it receives context menu.
I want to disable this.
How can I do this ?
That's not the behavior that I am seeing. What I see is that the event is fired and the items are cleared. However when the pane is floating a small popup is still shown (with no contents). It sounds like you are experiencing something else so I would recommend submitting a sample to the support group so it can be investigated.
I'm not sure that it is really bug.
May be I don't understand something, but this behaviour is very strange.
I checked that if content pane is in its regular state (docked) then right click event is handled by my defined method
contentPane.OptionsMenuOpening += new EventHandler<PaneOptionsMenuOpeningEventArgs>(contentPane_OptionsMenuOpening);
But when content pane becomes floating pane (after double click on header) right click is not handled by my method. I checked this in debugger. It even no enters this method.
Andrew, can you explain this ?
The menu items aren't there but its still trying to show the contentmenu? That sounds like a bug and should be reported to the support group. If there are no items, we shouldn't be trying to show the menu.
Thanks.
I handled OptionsMenuOpening event
{ e.Items.Clear(); }
It really works.
It writes some binding error messages in my output screen. I think that I can ignore them.
But know I have to solve another problem.
When my content panel becomes Floating panel I still have this annoying context menu when I right click on floating pane header.
How can I disable it ?
The context menu is shown when right clicking on the PaneHeaderPresenter or PaneTabItem if it does not have its ContextMenu property set. So if you don't want the context menu then you would have to provide a style for those elements that sets the ContextMenu (e.g. set it to x:Null). Another option is to handle the OptionsMenuOpening of the ContentPane and clear the Items property of the event arguments. The downside to the latter is that this event is also invoked when you dropdown the position menu item in the pane's header so if you still want that then you might have to look at the items in the list and only clear it if the items have a ContextMenu as their logical parent.