ContextMenuForWindows11
ContextMenuForWindows11 copied to clipboard
Access from WinUI 3
Hi, Can you create a Library with easy access in C# (WinUI 3)?
https://github.com/ikas-mc/ContextMenuForWindows11/tree/main/ContextMenuCustom/ContextMenuCustomHost This is an independent project... Can be used in winui3
<com:Extension Category="windows.comServer">
<com:ComServer>
<com:SurrogateServer DisplayName="Custome Context Menu">
<com:Class Id="46F650E5-9959-48D6-AC13-A9637C5B3787" Path="ContextMenuCustomHost.dll" ThreadingModel="STA"/>
</com:SurrogateServer>
</com:ComServer>
@ikas-mc tnx, i used in my app and i cant see my menu!
Should I do something else?
https://github.com/ikas-mc/ContextMenuForWindows11/blob/main/ContextMenuCustom/ContextMenuCustomPackage/Package.appxmanifest
I still can't see the created menu. Do I have to change something special in vcxproj? or something else in appxmanifest? I copied your codes exactly App31.zip
@ikas-mc I'm still having trouble creating a menu, Can you take a look at what I'm doing?
i added ContextMenuCustomHost project to my project and i added as a refrence project. then I specified the output location of the project

I also edited the manifest file
<Extensions>
<desktop4:Extension Category="windows.fileExplorerContextMenus">
<desktop4:FileExplorerContextMenus>
<desktop5:ItemType Type="Directory" >
<desktop5:Verb Id="CustomMenu" Clsid="46F650E5-9959-48D6-AC13-A9637C5B3787" />
</desktop5:ItemType>
<desktop5:ItemType Type="*" >
<desktop5:Verb Id="CustomMenu" Clsid="46F650E5-9959-48D6-AC13-A9637C5B3787" />
</desktop5:ItemType>
<desktop5:ItemType Type="Directory\Background">
<desktop5:Verb Id="CustomMenu" Clsid="46F650E5-9959-48D6-AC13-A9637C5B3787" />
</desktop5:ItemType>
</desktop4:FileExplorerContextMenus>
</desktop4:Extension>
<com:Extension Category="windows.comServer">
<com:ComServer>
<com:SurrogateServer DisplayName="Custome Context Menu">
<com:Class Id="46F650E5-9959-48D6-AC13-A9637C5B3787" Path="ContextMenuCustomHost.dll" ThreadingModel="STA"/>
</com:SurrogateServer>
</com:ComServer>
</com:Extension>
<uap3:Extension Category="windows.appExecutionAlias">
<uap3:AppExecutionAlias>
<desktop:ExecutionAlias Alias="customeContextMenuDebug.exe"/>
</uap3:AppExecutionAlias>
</uap3:Extension>
</Extensions>
I ran the app, but I didn't see any new menu for my program, I restarted the Explorer, I still didn't see anything. I decided to create a menu (json):
private async void myButton_Click(object sender, RoutedEventArgs e)
{
MenuService menuService = new MenuService();
var menu = new MenuItem
{
Exe = "\"C:\\Program Files\\Notepad3\\Notepad3.exe\"",
Param = "\"{path}\"",
Title = "open in notepad"
};
await menuService.SaveAsync(menu);
}
Nothing happens again. Where is my work wrong, what have I left out?
@ghost1372

- backup some menu json
- uninstall ContextMenuCustomApp(uwp)
- build host, copy dll to ContextMenuCustom-winui3, run ContextMenuCustom-winui(package),then ,click button to open config folder
- copy menu json to folder
@ghost1372
- backup some menu json
- uninstall ContextMenuCustomApp(uwp)
- build host, copy dll to ContextMenuCustom-winui3, run ContextMenuCustom-winui(package),then ,click button to open config folder
- copy menu json to folder
Thanks, I learned how to use it completely
Hi @ikas-mc I have a question, I want to run my packaged app when the menu is clicked, so what should I enter in the exe section? As you know, the exe file of the packaged programs does not run
use windows.appExecutionAlias https://learn.microsoft.com/en-us/uwp/schemas/appxpackage/uapmanifestschema/element-desktop-executionalias like this
<uap3:Extension Category="windows.appExecutionAlias">
<uap3:AppExecutionAlias>
<desktop:ExecutionAlias Alias="customeContextMenuDebug.exe"/>
</uap3:AppExecutionAlias>
</uap3:Extension>