Mark
Mark

Reputation: 11

Problems with adding images in Silverlight

Could someone tell me how do add an image to a canvas in detail? I tried this:

    <Image Source="pics/foo.png" Stretch="Fill" Canvas.Left="350" Canvas.Top="74"
                       Width="100" Height="103" Margin="10,10,10,10"/>

The folder "pics" is in Projects/AppName. When I load the project, I just see the blank canvas. Do I have to add the picture to resources folder in VS or something?

Upvotes: 1

Views: 142

Answers (1)

Phil Wright
Phil Wright

Reputation: 22906

Here the Source value is relative to your XAP location. So you need to add your images into the 'ClientBin' folder of your project. So drag your pics folder from the project location inside the 'ClientBin' and then your Source setting should work.

For more info check this link.

Upvotes: 1

Related Questions