Xamarin Forms: How to use Embedded Resources in PCL Project for Image

风流意气都作罢 提交于 2019-12-10 14:48:43

问题


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");

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


回答1:


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

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


来源:https://stackoverflow.com/questions/35941437/xamarin-forms-how-to-use-embedded-resources-in-pcl-project-for-image

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!