如何在XAML中设置图像源 [英] How to set image source in xaml

查看:107
本文介绍了如何在XAML中设置图像源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用xaml创建图像
这是我的简单代码
但是

<

I am creating an image in xaml
here is my simple code
But

<

 

图片 宽度 ="20" 边距 ="100" x : 名称 = " currentIndicator" 来源 =" test.gif"//gt;

错误16 文件test.gif不是项目的一部分,或者其构建操作"属性未设置为资源".

我检查了一下,test.gif位于资源"中,并将其构建操作属性设置为资源",任何人都可以提供帮助.

Image Width="20" Margin="100" x:Name="currentIndicator" Source="test.gif"/>

Error 16 The file test.gif is not part of the project or its 'Build Action' property is not set to 'Resource'.

I checked, test.gif is in Resource and I set it's build action property to Resource,  anybody can help.

推荐答案

您的意思是:测试. gif位于资源"中?那是一个名为"Resource"的目录吗?在项目中?然后,您的路径需要为Source =" Resource \ test.gif"
What do you mean: "test.gif is in Resource"?  Is that a directory called "Resource" in the project?  Your path would then need to be Source="Resource\test.gif"


这篇关于如何在XAML中设置图像源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆