Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Windows Explorer context menus within WPF

Is there a way to gain access to the Windows Explorer shell context menus for files & folders without using a complete Explorer drop-in control?

The gist of my plight is this: I have a Viewport3D that displays a handful of raw files & folders. Basically, it's like every other 3d explorer replacement you've ever seen :)
When I right-click one of these entries, I'd like to see the Explorer context menu for that file pop up.
Can I get that context menu from Windows, or do I have to construct my own?

Thanks in advance,

_b34r

like image 548
b34r Avatar asked Nov 05 '22 16:11

b34r


1 Answers

The ShellContextMenu class in this library almost does what you want:

http://gong-shell.sourceforge.net/

Only thing is that it expects WinForms Control. However, if you modify the library to add an addtional ShowContextMenu method which accepts a hWnd, you should be able to pass is the hWnd of your top-level WPF Window.

like image 197
Grokys Avatar answered Nov 14 '22 20:11

Grokys