Xamarin.forms giving “invalid cross thread access” Exception in windows8 emulator

一笑奈何 提交于 2020-05-30 07:15:27

问题


Xamarin.forms is working fine in android phones but in window8 emulator it is not loading image and giving invalid cross thread access exception.

I'm using Embedded Image Technique, I'm storing all images in common folder and accessing from shared project.

snapshot of my project is as follows:

enter image description here

Error is As follows :

enter image description here

In window8 simulator images are not loading

enter image description here

Any help will be much appreciated.


回答1:


This is because you are updating a UI element on a non UI thread, you want to use Device.BeginInvokeOnMainThread, like so:

Device.BeginInvokeOnMainThread(() => MainPage.DisplayAlert("Boom", message, "Cancel"));


来源:https://stackoverflow.com/questions/27156802/xamarin-forms-giving-invalid-cross-thread-access-exception-in-windows8-emulato

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