Friday, April 11, 2008

Silverlight: Image tag not working

If you are using Silverlight 2.0 Beta 1 and are trying to simply display an image that is a resource in your project, in lets say the Resources resource folder it seems like a simple task. Unfortunately Silverlight wont tell you if you make the most basic mistake in this beta version.

image

In the example above you must reference the image in the resource folder by using a forward slash in the XAML Source property of your <image> tag, not a backslash! Use the backlash and nothing will display.

Its a simple, armature mistake but it can cost you a lot of time. Here is the proper syntaxes example:

image

I am sure in the future this will get easier and provide more information for such simple mistakes.

0 comments: