Skip to main content

Microsoft Silverlight

Answered Question Resource Build Action not workingRSS Feed

(0)

chemist
chemist

Member

Member

251 points

53 Posts

Resource Build Action not working

Hello Everybody,

I've some images in .png form. I added these images to a folder and set their build action to Resource. The problem i get is that when i debug the SL project, I got the exception saying:

Invalid URI: A port was expected because of there is a colon (':') present but the port could not be parsed. 

 pack://application:,,/Folder/Img0{0}.png"

 the first parameter {0} is replaced with the count of image. Image names are

Img00, Img01, img02 and so on. What I'm missing here? please help me in this regard.

Thanks
 

robhouweling
robhouwe...

Contributor

Contributor

3158 points

540 Posts

Silverlight MVP
Answered Question

Re: Resource Build Action not working

When you want to use an image that is build as a resource, its included in the XAP file and you can use it like you would when the image was in the folder the XAP is in.

Uri imageUri = new Uri(String.Format("Img0{0}.png", counter), UriKind.Relative);

 

(If this has answered your question, please click on mark as answer on this post)

Cheers!
Rob Houweling



My blog
  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities