device.begininvokeonmainthread deprecated

Alessandro Caliaro 4,196 Reputation points
2023-02-14T10:44:01.4166667+00:00

Device.BeginInvokeOnMainThread is deprecated.

We should use BindableObject.Dispatcher.Dispatch.

Is it possible to have an example how to use Dispatcher.Dispatch on MVVM?

Thanks

Alessandro

Developer technologies | .NET | .NET MAUI
0 comments No comments
{count} votes

Accepted answer
  1. Anonymous
    2023-02-15T01:23:30.25+00:00

    Hello,

    You can use MainThread.BeginInvokeOnMainThread to run code on the UI thread in MAUI.

    Here is a document about creating a thread on the .NET MAUI UI thread

    Best Regards,

    Leon Lu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    2 people found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.