Hello @Sami ,
You can check the similar thread - How do you use BindableObject.Dispatcher.DispatchAsync() in .NET MAUI? - Microsoft Q&A
Microsoft.Maui.Controls.BindableObject
is MAUI's root class for objects that can be bound - it is very high in the MAUI class hierarchy, and almost all MAUI objects inherit from it. See Data Binding Basic.
From the code snippets, it's not clear to me what type of your AnimationBase
is, it might derive from View
or Layout
or other Microsoft.Maui.Controls
. Since there is a bindable property, it means that the target object ( AnimationBase
) must derive from BindableObject
. BindableObject
have a Dispatcher
property which can be used to get access to the main thread. You could try
this.Dispatcher.Dispatch(() =>
{
...
})
For more details, you can check Dispatcher.Dispatch(Action) Method (Microsoft.Maui.Dispatching) | Microsoft Learn
and BindableObject.Dispatcher Property (Microsoft.Maui.Controls) | Microsoft Learn
Best Regards,
Wenyan Zhang
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.