Skip to content
Discussion options

You must be logged in to vote

The result of the GetMessage() is coming back on a non-UI thread, meaning PropertyChanged is invoked on a non-UI thread.

GPT-4 can handle the rest:


In WinUI or UWP, you cannot invoke PropertyChanged on a non-UI thread because the UI elements can only be accessed from the UI thread. If you attempt to access UI elements from a non-UI thread, you may encounter unexpected behavior or crashes in your application.

To update UI elements from a non-UI thread, you can use the Dispatcher.RunAsync method in UWP or DispatcherQueue.TryEnqueue method in WinUI 3. Here's an example of how to use Dispatcher.RunAsync in UWP:

Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunA…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Diyari-Kurdi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants