在WPF中添加和更改图片 [英] add and change picture in WPF

查看:581
本文介绍了在WPF中添加和更改图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我尝试制作一个聊天应用程序,并且我已经运行了大约65%,并且卡在添加和更改图片中,如果我在WPF中创建添加和更改图片,或者也许图片掉落或更改图片之类的东西?我应该怎么办?感谢CodeProject

hello , i try to make a chat application, and i have been running about 65%, and i''m stuck in add and change picture, it''s possible if i create add and change picture in WPF or maybe something like image drop or change picture? what supposed to be i do? thanks CodeProject

推荐答案

您必须说明图片的来源.如果它在应用程序中或在Internet上,则只需将属性绑定到源即可:

You have to state where the picture is coming from. If it is within the application, or on the internet, then all you have to do is bind the property to the source:

<image source="{Binding Path=Image}" /> 



因此,您在ViewModel中具有一个包含路径的属性.对于其中的某些程序集,您可能想要一个类似以下的路径:



Thus you have a property in your ViewModel that contains the path. For something in on of the assemblies you might want to have a path looking like:

"/Fox.UI.Shell;component/Images/WoodenBucket.png"



我相信您也可以绑定到位图对象.



I believe you can also bind to a bitmap object.


更改图片您可以尝试多种方法,一种方法似乎是将列表加载到图像组件中,然后再将其加载到图像组件中重复您想要的时间.然后,要进行更改,可以使它们不可见.
the change picutre you can try many ways, one way seems the simplist is to add the image load it up in the image componet and then repeat for the amount of time you want. And after then to make the change you can jsut make them invisible.


这篇关于在WPF中添加和更改图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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