改变形象 [英] change image

查看:104
本文介绍了改变形象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从代码中更改imageSource?

How am I change imageSource from the code?

我写道:

I write:

tbImage

 

. ImageSource = BitmapImage ( Uri ( )));

.ImageSource = new BitmapImage(new Uri(@"\profile\a.gif"));

,并且它没有变化.

 

 

 

推荐答案

请检查以下步骤:

Please, do check the following steps:

1-添加一个." URI路径开头的字符.

1- Add a '.' character at the start of the URI path.

2-使用'/'代替'\'

2- Use '/' instead of '\'

3-设置"UriKind".到相对"即:tbImage.ImageSource = new BitmapImage(new Uri(@"./profile/a.gif",UriKind.Relative));

3- Set the "UriKind" to "Relative" i.e: tbImage.ImageSource = new BitmapImage(new Uri(@"./profile/a.gif", UriKind.Relative));

请在我的回复中将其标记为已答应"如果有帮助的话.

Please, mark my reply as "Asnwered" if it helped.


这篇关于改变形象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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