Xamarin表单:如何在PCL项目中使用嵌入式资源进行图像处理 [英] Xamarin Forms: How to use Embedded Resources in PCL Project for Image

查看:155
本文介绍了Xamarin表单:如何在PCL项目中使用嵌入式资源进行图像处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的资源目录中有4张图片进入我的可移植项目,我想直接将它们用于 ImageSource (因为我需要绑定它。)

I have 4 Images in my Resources Directory into my Portable Project and i would like to use them directly for an ImageSource (because i need to bind it).

ImageSource myImageSource = ImageSource.FromResource("resources.image.png");

我试过这个,但它无法识别路径。如何将我的图像用于ImageSource?

I tried this but it doesn't recognize the path. How can i use my images for an ImageSource ?

推荐答案

好的,我的错误我在资源目录之前忘记了我的项目名称

Ok, my bad i forgot the name of my project before the Resources directory

ImageSource myImageSource = ImageSource.FromResource("NameOfProject.Resources.image.png");

这篇关于Xamarin表单:如何在PCL项目中使用嵌入式资源进行图像处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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