Maui Toolkit Appearing and Disappearing commands not triggering after upgrading from .NET8 to .NET10

Peter Stuart 0 Reputation points
2026-07-09T09:59:03.6033333+00:00

I have a MAUI app written in XAML and C# that I have recently upgraded from .NET8 to .NET10. I had a lot of functionality change which I was able to fix but I have noticed that my Appearing and Disappearing commands have stopped working which has destroyed a lot of my app's functionality. I have written the app using MVVM and I intend to keep it that way, rather than hacking around the view to get my Appearing and Disappearing code to work again.

In my login page I used to have this in the View:

    <ContentPage.Behaviors>
        <toolkit:EventToCommandBehavior EventName="Appearing" Command="{Binding AppearingCommand}"/>
    </ContentPage.Behaviors>

And this in the ViewModel:

        public DeviceLoginViewModel(ICaptureApi cApi) {
            LoginCommand = new AsyncRelayCommand(Login, ValidateLogin);
            AppearingCommand = new AsyncRelayCommand(OnAppearing);
            PropertyChanged += (_, __) => MainThread.BeginInvokeOnMainThread(LoginCommand.NotifyCanExecuteChanged);
            AutoBusy = false;
            _cApi = cApi;
        }


        public ICommand AppearingCommand { get; }

        async Task OnAppearing() {
            CaptureApiKey = Settings.CaptureApiKey;

            if (CaptureApiKey.Trim().Length != 0) {
                await LoginCommand.ExecuteAsync(null);
            }
            else {
                ShowForm = true;
            }
        }

This used to have it so that when the user opens the app, the app logs in automatically. However, after updating to the latest .NET version, this does not work anymore.

I have tried updating the XAML in the view to this:

    <ContentPage.Behaviors>
        <toolkit:EventToCommandBehavior EventName="Appearing" Command="{Binding AppearingCommand}" BindingContext="{Binding Source={x:Reference MyPage}, Path=BindingContext}"/>
    </ContentPage.Behaviors>

But the OnAppearing() tasks is still never hit.

Developer technologies | XAML
Developer technologies | XAML

A language based on Extensible Markup Language (XML) that enables developers to specify a hierarchy of objects with a set of properties and logic.

0 comments No comments

1 answer

Sort by: Newest
  1. Nancy Vo (WICLOUD CORPORATION) 8,155 Reputation points Microsoft External Staff Moderator
    2026-07-09T11:04:21.9266667+00:00

    Hello @Peter Stuart ,

    Thanks for your question.

    When updating to the .NET 10 Community Toolkit, Behaviors no longer connect to the ViewModel automatically. You correctly added BindingContext="{Binding Source={x:Reference MyPage}, Path=BindingContext}" to manually fix this.

    However, the command may fail silently because it cannot find "MyPage".

    I want to confirm again if you have added the name tag x:Name="MyPage" to your ContentPage at the very top of your XAML file.

    <ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
                 xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
                 x:Class="YourApp.Views.LoginPage"
                 x:Name="MyPage"> ```
    

    Please try this and let me know whether it resolves the issue. If not, I'd be happy to investigate further.

    I hope this addresses your question. If this response was helpful, please consider following the guidance to provide feedback. Thank you.

    Was this answer helpful?


Your answer

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