[ I'll provide a full solution download to anyone interested ]
Our Goals were:
1) Use images in XAML syntax like this:
<Image Name="imageSave" Height="16" Width="16" Source="ui:Images.ico_save_16.png"/>
2) Break on invalid image references at COMPILE - not at runtime.3) Automatically add new when new images are copied into project.4) Share resources within solution across projects.5) Get intellisense for images from different projects in the same solution where possible (currently only in the codebehind - but the xaml editor will eventually provide intellisense here too).6) VS 2008
We created a separate "Resources" class library. In that class library we created an Images folder and under that an "ico" and "png" folders with all our images. Not added to "Resources" or "settings" as these generate only internal strongly typed - you need public.
Inside that class library create a text template - I called it Generator.tt. This text template will scan your directory of files and output something like this (below). We have two sub properties "ico" and "png" for the same resource... but you don't have to have that complexity.
The only really tricky part in creating the tt file was figuring out how to find the current directory to scan the project files...
string icoPath = this.Host.ResolvePath(@"Images\ico");
This is very close to what I've been looking for. I'd love to see the solution. You can email it to me at firstname.lastname@example.org
Thanks for this!
When are we going to get intellisense for StaticResources like images? This is causing me a lot of grief...
I would be interested in any options, even Snippets like I get with XamlPad.
I NEED ENCAPSULATION :(