Reputation: 57
I've converted my WPF application using Desktop App Converter to appx package. I need to have an item in explorer context menu. I.e. user right mouse clicks on file and sees my item "Do action with Application" in main menu. On item selection my application starts with command line arguments of selected file. I don't need "windows.fileTypeAssociation" and "open with Application" in submenu. I want my item on top level menu.
So, the steps I've done:
In Package folder I've changed AppxManifest.xml file:
...
<Extensions>
<desktop4:Extension Category="windows.fileExplorerContextMenus">
<desktop4:FileExplorerContextMenus>
<desktop4:ItemType Type=".jpg">
<desktop4:Verb Id="Foo" Clsid="91dce9db-f066-366b-be01-abcdd41e5cf1"/>
</desktop4:ItemType>
</desktop4:FileExplorerContextMenus>
</desktop4:Extension>
</Extensions>
...
Note: I haven't found where could I get ClsId for my application and this is GUID of the other application.
So after all these actions I've not seen any new items in context menu. I've tried to do "windows.fileTypeAssociation" before in similar way. It's worked for me.
Researhing the subj I've found that many colleagues tried to solve this problem with no success, for example:
https://github.com/MicrosoftDocs/winrt-related/issues/117
Summary. Is it possible to implement explorer context menu item for UWP ? If possible, what I've doing wrong ? Have somebody done it with success ? Any working solutions, examples ? Sensible manuals ? And where could I get "Clsid" ?
Upvotes: 3
Views: 1654
Reputation: 32775
The CLSID can be that of a packaged COM server declared in the same app’s manifest. Here’s an example:
<desktop4:Extension Category="windows.fileExplorerContextMenus">
<desktop4:FileExplorerContextMenus>
<desktop4:ItemType Type=".txt">
<desktop4:Verb Id="Command2" Clsid="E694BDCD-DCEB-42B6-9C1A-8A604F8XXXXX" />
</desktop4:ItemType>
</desktop4:FileExplorerContextMenus>
</desktop4:Extension>
<com:Extension Category="windows.comServer">
<com:ComServer>
<com:SurrogateServer DisplayName="context menu verb handler 2">
<com:Class Id="E694BDCD-DCEB-42B6-9C1A-8A604F89F2D1" Path="Providers.dll" ThreadingModel="STA"/>
</com:SurrogateServer>
</com:ComServer>
</com:Extension>
Clsid is the comserver that should implement IExplorerCommand
representing the context menu verb.
Upvotes: 1