dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.24k stars 1.76k forks source link

In windows and ios the RequestedThemeChanged event only fires the first time. #25864

Open JPfahl opened 6 hours ago

JPfahl commented 6 hours ago

Description

Works in Android but in windows and ios you only ever get the event once, you have to restart the app to get it to fire again.

Steps to Reproduce

The following code in App.xaml.cs demonstrates the issue in a new default maui project:

public partial class App : Application
{
    public App()
    {
        InitializeComponent();

        MainPage = new AppShell();

        RequestedThemeChanged += App_RequestedThemeChanged;
    }

    private void App_RequestedThemeChanged(object? sender, AppThemeChangedEventArgs e)
    {
        UserAppTheme = e.RequestedTheme;
    }
}

Link to public reproduction project repository

No response

Version with bug

8.0.93 SR9.3

Is this a regression from previous behavior?

No, this is something new

Last version that worked well

No response

Affected platforms

iOS, Windows

Affected platform versions

No response

Did you find any workaround?

No response

Relevant log output

similar-issues-ai[bot] commented 6 hours ago

We've found some similar issues:

If any of the above are duplicates, please consider closing this issue out and adding additional context in the original issue.

Note: You can give me feedback by 👍 or 👎 this comment.