问题
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:
Error is As follows :
In window8 simulator images are not loading
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