I'm making an application that updates a UI element after a press on a button connected to the GPIO pins. it's my first time working with windows iot core. I thought it would be as easy as this "lblQuestion.Text = "Button works!";" but it isn't. can anyone tell me what I have to add for it to work correctly?
I'm recieving this error: System.Exception: 'The application called an interface that was marshalled for a different thread. (Exception from HRESULT: 0x8001010E (RPC_E_WRONG_THREAD))'
Please use following code to to marshal calls coming from non-UI threads.
await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
{
lblQuestion.Text = "Button works!
});
This document describes the reason why you need to create a DependencyObject on a UI thread.
User contributions licensed under CC BY-SA 3.0