开发者

Silverlight app Image not showing at runtime

In Visual Studio 2010 I have created a new project with the Silverlight Business Application template. I added 开发者_运维百科an Images folder under the Assets folder. The png files in this folder have Build Action set to Resource, and Copy To Output Directory set to Always. In the header section I added an <Image Source="Assets\Images\logo.png" /> element. In design time it displays my image. At runtime it does not. Any idea as to why my image is missing at runtime? --Shawn


I had a similar problem with images showing in design-time, but not at runtime. Mine was using a pack URI so I wanted to post that fix as well:

Does not work at runtime, does work at design-time:

<Image Source="TelerikDemo;component/Images/logo.png" />

Works at both design and runtime:

<Image Source="/TelerikDemo;component/Images/logo.png" />

Note the extra '/' before the Pack URI starts.


hmf! Turns out my backslashes needed to be forward slashes!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜