Use Built-In Application Icon Resources on Windows Phone
Join the DZone community and get the full member experience.Join For Free
NOTE: I am not sure how this will affect Marketplace certification for your application.
Internally, a lot of images are referenced as resources. For example, the icons you see for stock OS applications are, in fact, local resources that can also be referenced from your own application.
Let’s start with the most basic approach – setting your application icon to be an OS resource. Open the WMAppMaifest.xml and find the IconPath and BackgroundImageURI nodes. If you are reading this blog, I am assuming that you already have the knowledge of what each node represents, but in case you don’t:
- IconPath – the icon shown in the app list in the secondary screen.
- BackgroundImageUri – the icon used for the app, if it is pinned to the home screen.
Set the IsResource attribute to true. Now, for the icon path use something like this:
Your modified node should look like this:
<IconPath IsRelative="true" IsResource="true">res://StartMenu!AppIconAlarms.png</IconPath>
Launch the application. Here is what you will get:
So the AppIconsAlarm.png represents the icon from the StartMenu set that is used for the Alarms application. Here is a (incomplete) list of resources that you could use here:
Where are these located? Obviously, in the DLLs that contain resources. In the case above, there is a StarMenu.dll that you can get if you dump the emulator ROM. A quick look at the contents with Resource Hacker gives us a glance at icons that you probably never saw before, like:
Here is a complete list of reusable icons from the StartMenu DLL:
With a bit more research, you could set the values to be more obscure, like res://accountsettings!error.png or res://accountsettings!warning.png (fair warning – not Metro-compatible here).
There is also ASIcons.dll where you can get icons related to email accounts (e.g. set.dark.exchange.png). FileIcons.dll contains icons that can be used as file format identifiers.
Opinions expressed by DZone contributors are their own.