© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
4 replies
kurumi

✅ async .NET MAUI binding

Hello, on Xamarin channel I found this code how to update UI with threads and async stuff.
https://youtu.be/-LY4ATA8Bgw?si=cRmPMFNjL9-zTxui&t=1212
But in .NET MAUI it says
Warning    CS0618    'Device.BeginInvokeOnMainThread(Action)' is obsolete: 'Use BindableObject.Dispatcher.Dispatch() instead'
Warning    CS0618    'Device.BeginInvokeOnMainThread(Action)' is obsolete: 'Use BindableObject.Dispatcher.Dispatch() instead'
. So how can I bind some async data from my API by using it?
Leave an example please 😄
using CommunityToolkit.Mvvm.ComponentModel;
using MRSUMobile.MVVM.Model;
using MRSUMobile.Services;

namespace MRSUMobile.MVVM.ViewModel
{
    public partial class AppShellViewModel : ObservableObject
    {
        IMrsuApiService mrsuApi;

        [ObservableProperty]
        User user = new User();

        public AppShellViewModel(IMrsuApiService mrsuApiService)
        {
            mrsuApi = mrsuApiService;

            // async binding of user ?
            // user = await mrsuApi.GetMyProfile();
        }
    }
}
using CommunityToolkit.Mvvm.ComponentModel;
using MRSUMobile.MVVM.Model;
using MRSUMobile.Services;

namespace MRSUMobile.MVVM.ViewModel
{
    public partial class AppShellViewModel : ObservableObject
    {
        IMrsuApiService mrsuApi;

        [ObservableProperty]
        User user = new User();

        public AppShellViewModel(IMrsuApiService mrsuApiService)
        {
            mrsuApi = mrsuApiService;

            // async binding of user ?
            // user = await mrsuApi.GetMyProfile();
        }
    }
}
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

.net maui Help
C#CC# / help
2y ago
.net Maui Help
C#CC# / help
2y ago
✅ .NET MAUI Layout
C#CC# / help
2y ago