ContextMenuOpening event not fired

Ribbon for WPF Forum

Posted 12 years ago by Kasper
Version: 11.2.0553
Platform: .NET 4.0
Environment: Windows 7 (64-bit)
Avatar

Hi guys,

It seems that the ContextMenuOpening event for the Ribbon ContextMenu is not firing. I can reproduce this with a TreeView like this:

<TreeView>
	<TreeView.ContextMenu>
		<ribbon:ContextMenu ContextMenuOpening="ContextMenu_ContextMenuOpening">
			<ribbon:Button Label="Test" />
		</ribbon:ContextMenu>
	</TreeView.ContextMenu>
</TreeView>

 I need this to set the e.Handled to true in certain scenarios where I don't want to show the menu anyway. As far as I can tell, ContextMenuClosing is not fired either. Hope you can fix it :)

Comments (2)

Answer - Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Kasper,

That is correct and is not a bug.  Those events will fire on TreeView or whatever target object is opening them, not on the ContextMenu itself.  The native WPF ContextMenu behaves the exact same way and is where all that functionality comes from, since we inherit it for ours.


Actipro Software Support

Posted 12 years ago by Kasper
Avatar

Oh yes, that works fine! I do wonder why the heck there is a ContextMenuOpening event on the ContextMenu it self then, if it's not used - that only adds confusion. But I guess that's not your problem :)

The latest build of this product (v24.1.3) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.