1
votes

I have an image in my Silverlight project's images folder, and its build action is set to Resource. I am referencing the image in my XAML like this:

<Rectangle Height="50" VerticalAlignment="Top" HorizontalAlignment="Stretch" Grid.Column="1" Grid.Row="1">
    <Rectangle.Fill>
        <ImageBrush ImageSource="images/sliver_header.png" ImageFailed="ImageBrush_OnImageFailed" />
    </Rectangle.Fill>
</Rectangle>

The image appears normally in design view, but when I debug the application (using ASP.NET), the image does not load. The weirdest part is that this image loaded fine before, but suddenly yesterday it quit loading.

I have also tried using /AssemblyName;component/images/sliver_header.png as the URI with no success.

The ImageFailed event gives me the error: AG_E_NETWORK_ERROR. This makes me think that Silverlight is not actually embedding the resource in the xap. I thought setting the build action to Resource caused the file to be embedded in the xap - is that correct?

I also have several other images in the Silverlight project that seem to be embedding properly (at least they load correctly in the browser). I am only having problems with this one image.

If I copy the image to the ClientBin/images folder in my ASP.NET project, then it loads fine. However, I want to embed the image, not load it as an external file. My question, then, is this: are there any possible reasons why is the image is not being embedded in the assembly?

1

1 Answers

1
votes

Try delete all solution files, and get new set of files from TFS again.