silverlight - 你如何在 Silverlight 中加载 png 资源图像?

标签 silverlight

我正在尝试在特定的 Silverlight 项目文件夹中添加一个 png 图像资源。我想在我的标签中引用这张图片?当包含图像标记的 xaml 文件与 png 文件位于同一目录中时,我似乎只能使用此方法。

例如,在 xap 文件中,png 文件将位于 xap\resource\image1.png 中,而我的 xaml 文件将位于根目录 xap\consumeImageA.xaml 中。

最佳答案

我找到了一篇讨论 USING URIS IN EXPRESSION BLEND 的博客文章这对我有用。

  • pack://application:,,,/Images/happyface.png is wrong. This will work from XAML,
    but not from code. It needs to be

  • pack://application:,,,/WpfApplication6;component/Images/happyface.png If you do this, Blend resolves well
    all the time!

关于silverlight - 你如何在 Silverlight 中加载 png 资源图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/272659/

相关文章:

wpf - DependencyProperty.OverrideMetadata 覆盖 PropertyChangedCallback

c# - Silverlight 真的不支持 OpenGL 吗?

wpf - 如何在 mvvm 中设计与 Viewmodel 的业务逻辑交互

silverlight - 在哪里可以找到 Office Web 应用程序的 xap 文件?

Silverlight MVVM 灯光列表框项目点击事件

Silverlight - Prism、Unity 和托管可扩展性框架,

silverlight - 在 Silverlight 中使用 WebClient.BaseAddress 获取基本 url 的替代方法

c# - 降低字符值的逻辑

Silverlight 4 - RIA 服务 - 这是很好的编码实践吗?

.net - 如何在 Silverlight 的组合框中为选定和下拉状态使用不同的模板?