GetImage loads PNGs from server

Jan 31, 2011 at 10:54 PM


Is it intentional that PropertyGrid.GetImage ends up loading images (in this case, plus.png and minus.png) from the server? If you set the startup project in the solution to the Web project and debug, you'll see that the plus/minus images don't actually load, and if you have break-on-exception enabled, the server will throw a "file not found" exception. If you use something like Fiddler to trace the requests you can see it's looking for assets/plus.png and assets/minus.png on the server.

There's a ton of conflicting and hard-to-parse information on the web about how to do load images from resources properly and easily, but if you keep everything else the same and change the GetImage calls so that the URIs are prefixed with "/SL40PropertyGrid;component/", they will load straight from the assembly and not hit the server. I think that's perfectly appropriate for images this small.



Feb 2, 2011 at 1:17 AM

No it wasn't, and good catch, thanks for the feedback.