Enumerate images resources at runtime.


  • is there a way to enumerate images resources that are embedded within my app (specifically images in some directory)?
    Monday, December 26, 2011 10:37 PM


All replies

  • Hi Ghost,

    When you author your application you include the images in your solution so you know what images you have included in your application package.  What is the scenario that would require you to do this through code?  Can you outline your scenario so I can better understand what you are trying to accomplish in your application?  What is "some directory" in your case?


    Jeff Sanders (MSFT)
    • Marked as answer by Ghostrider-13 Wednesday, December 28, 2011 6:18 AM
    • Unmarked as answer by Ghostrider-13 Wednesday, December 28, 2011 6:18 AM
    Tuesday, December 27, 2011 3:18 PM
  • Yeah, I know that I'm supposed to know the files that are built into the app :) it's just that there are 100+ of them and I will add and remove them on a regular basis so I though that there may be a solution that I overlooked besides having a piece of code that is kept in sync with these files either though manual updates or custom build step.

    It would be nice if I could programmatically enumerate images in folder like "/images/nuts" and "/images/bolts"

    Wednesday, December 28, 2011 6:21 AM
  • Hey Ghost,

    I stumbled on this sample: http://code.msdn.microsoft.com/windowsapps/Package-sample-46e239fa

    You should be able to get the package install directory and read the contents that way.


    Jeff Sanders (MSFT)
    • Marked as answer by Ghostrider-13 Friday, December 30, 2011 2:07 AM
    Thursday, December 29, 2011 1:21 PM
  • Thanks!

    This did the trick - exactly what I needed.

    Friday, December 30, 2011 2:08 AM