WP7 Application bar icons in a separate assembly

by Mikael Koskinen 14. December 2011 20:49

During today’s Windows Phone development session I encountered a problem with the application bar icons. The problem was simple: The application bar and its icons worked correctly inside the startup project but my pages inside the secondary project didn’t show the application bar icons.  I had the icons inside the secondary project and I checked million times that their build action was set to Content. And that was the problem: I forgot that the application bar icons must always be inside the startup project.

I suppose this is basic stuff and I should have known better, but sometimes these just take too much time to solve so hopefully the following helps someone else fighting with the same problem.

So, to solve my problems I had to do the following:

  1. Move the icons from the secondary module into the startup project
  2. Leave the IconUri-property as it was. No component keyword, nothing.

Now the startup project contains the icons:

image

The secondary module project contains the page and no icons:

image

The page inside the secondary module references the icons as if they were inside its own project:

image

ReSharper will tell you that the file doesn’t exist but it still works.

Comments (1) -

koldo
12/22/2011 7:47:28 PM #

Incredible, it works.
A simple solution to a so serious problem ,
but I never would have thought that solution.

I have a common library (menu) to all of my applications, but I could not see the image of the icons because in the library all images must be of resource type, but the icon uri only supports content type.

The only downside is that the images of the icons must be in the application, but it is a lesser evil.

I have been several days desperate.
Thank you very much for your help.

http://windowsphoning.wordpress.com/

Reply

Pingbacks and trackbacks (1)+

Add comment

biuquote
  • Comment
  • Preview
Loading