In one of my application, I added a new item in the Windows Explorer context menu of Windows 11. This worked well, but now I want to add a group of items. I could achieve that by updating the AppxManifset.xml file of my application, joined below.
I get this result:
However I want my menu to look like this:
I know how to change the items owned in my group (i.e. "My first command" and "My second command"). To achieve that I can modify my classes inherited from IExplorerCommand in my project.
But I don't know how to modify the group item itself, as it exists only in my appxmanifest.xml file. I want to change the title and to show the application icon, as pointed by the red arrows above.
Can someone explain me how I can achieve that?
Below is my application manifest, from which I generate the sparse package:
<?xml version="1.0" encoding="utf-8"?>
<Package
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
xmlns:uap2="http://schemas.microsoft.com/appx/manifest/uap/windows10/2"
xmlns:uap3="http://schemas.microsoft.com/appx/manifest/uap/windows10/3"
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10"
xmlns:desktop4="http://schemas.microsoft.com/appx/manifest/desktop/windows10/4"
xmlns:desktop5="http://schemas.microsoft.com/appx/manifest/desktop/windows10/5"
xmlns:uap10="http://schemas.microsoft.com/appx/manifest/uap/windows10/10"
xmlns:com="http://schemas.microsoft.com/appx/manifest/com/windows10"
IgnorableNamespaces="uap uap2 uap3 rescap desktop desktop4 desktop5 uap10 com">
<Identity Name="MyCompany.MyApp" ProcessorArchitecture="x64" Publisher="CN=MyCertificateName, O=MyCertificate, S=MyLocation, C=MU" Version="1.0.2.0" />
<Properties>
<DisplayName>My Application</DisplayName>
<PublisherDisplayName>My Company</PublisherDisplayName>
<Logo>Assets\storelogo.png</Logo>
<uap10:AllowExternalContent>true</uap10:AllowExternalContent>
</Properties>
<Resources>
<Resource Language="en-us" />
</Resources>
<Dependencies>
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.18950.0" MaxVersionTested="10.0.22631.0" />
</Dependencies>
<Capabilities>
<rescap:Capability Name="runFullTrust" />
<rescap:Capability Name="unvirtualizedResources"/>
</Capabilities>
<Applications>
<Application Id="MyApp" Executable="MyApp.exe" uap10:TrustLevel="mediumIL" uap10:RuntimeBehavior="win32App">
<uap:VisualElements AppListEntry="none" DisplayName="MyApp" Description="This is my application group." BackgroundColor="transparent" Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png">
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png" Square310x310Logo="Assets\LargeTile.png" Square71x71Logo="Assets\SmallTile.png"></uap:DefaultTile>
<uap:SplashScreen Image="Assets\SplashScreen.png" />
</uap:VisualElements>
<Extensions>
<desktop4:Extension Category="windows.fileExplorerContextMenus">
<desktop4:FileExplorerContextMenus>
<desktop5:ItemType Type="Directory">
<desktop5:Verb Id="MyFirstCmd" Clsid="11111111-1111-1111-1111-111111111111" />
<desktop5:Verb Id="MySecondCmd" Clsid="99999999-9999-9999-9999-999999999999" />
</desktop5:ItemType>
<desktop5:ItemType Type=".txt">
<desktop5:Verb Id="MyFirstCmd" Clsid="11111111-1111-1111-1111-111111111111" />
<desktop5:Verb Id="MySecondCmd" Clsid="99999999-9999-9999-9999-999999999999" />
</desktop5:ItemType>
</desktop4:FileExplorerContextMenus>
</desktop4:Extension>
<com:Extension Category="windows.comServer">
<com:ComServer>
<com:SurrogateServer DisplayName="My application group"> <== !!! THIS HAS NO EFFECT!
<com:Class Id="11111111-1111-1111-1111-111111111111" Path="MyAppDll.dll" ThreadingModel="STA"/>
<com:Class Id="99999999-9999-9999-9999-999999999999" Path="MyAppDll.dll" ThreadingModel="STA"/>
</com:SurrogateServer>
</com:ComServer>
</com:Extension>
</Extensions>
</Application>
</Applications>
</Package>
-------- EDIT 1 --------
I could finally find how to modify the text of the context menu, it's by changing the content of the DisplayName attibute on the below line in the AppxManifest.xml file:
<uap:VisualElements AppListEntry="none" DisplayName="My application group" Description="This is my application group." BackgroundColor="transparent" Square44x44Logo="Assets\Square44x44Logo.png" Square150x150Logo="Assets\Square150x150Logo.png" />
I also noticed that the Square44x44Logo attribute on the same line is the logo shown next to the item caption, and the reason why I could not show it was because the file was missing.
However I tried to add the missing image files in the Asset folder close to my application exe file. I used the images from this demo project as a test: https://github.com/microsoft/AppModelSamples/tree/master/Samples/SparsePackages/PhotoStoreDemoPkg/Assets
I get this result:
So the transparency is broken. Can someone explain me what I'm doing wrong? I heard about unplated assets issue and a tool named MakePri.exe (uap:VisualElements BackgroundColor not working correctly), has someone more info about a such issue?



So after many searches, below is the solution:
The name is located in the
DisplayNameattribute of the<uap:VisualElements>tag, in theAppxManifset.xmlfile.The icon is declared in the
Square44x44Logoattribute of the<uap:VisualElements>tag, in theAppxManifest.xmlfile. However just adding anAssetfolder close to the DLL, containing theSquare44x44Logo.pngfile is not enough. Transparency will be lost in this case. To take advantage of unplated assets, you need to compile aresources.prifile, which should be also added close to the DLL. The link below explains how to compile a such file:https://learn.microsoft.com/en-us/windows/msix/desktop/desktop-to-uwp-manual-conversion#optional-add-target-based-unplated-assets
With these 2 steps above, the group item will be shown as expected in the Windows 11 context menu.
NOTE restarting your PC, or at least the Windows Explorer task, may be required in order to apply the changes, once the final Sparse Package is registered in your system and the resources are copied close to the DLL.