Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to "Snoop" a ContextMenu?

Tags:

c#

wpf

snoop

I have a ContextMenu that uses a CompositeCollection for its ItemsSource. One of the items (the one that is in a bound collection, as opposed to hard-coded) is displayed differently from the rest.

I didn't see anything obvious in the XAML as to why this is, so I thought I would use Snoop to look at the actual rendered style (and find the difference). However, whenever I activate the Snoop window to look for the Context Menu, it closes the menu!

Is there a way to use Snoop (or a similar tool) to inspect a ContextMenu?

like image 474
BradleyDotNET Avatar asked May 28 '14 18:05

BradleyDotNET


1 Answers

Whenever user performs any action outside of an opened ContextMenu will get closed. This is default behaviour of the ContextMenu, But still Snoop provides all the informations about the ContextMenu and it's MenuItems in the VisualTreeView of the Snoop window on Left side. If you want to snoop a specift ContextMenuItem

  • Attach your application with the Snoop
  • Press Shift+Ctrl and mouse over to the ContextMenuItem you want to snoop which shows a Red border. Also the same control will be selected in the Treeview of the Snoop window
like image 83
Vimal CK Avatar answered Sep 17 '22 00:09

Vimal CK