Closed AswinPG closed 1 year ago
The calculator sample app show a possible implementation: https://github.com/adospace/reactorui-maui/blob/main/samples/Calculator/Pages/MainPage.cs
protected override void OnMounted()
{
if (MauiControls.Application.Current != null)
{
MauiControls.Application.Current.RequestedThemeChanged += (sender, args) => Invalidate();
}
base.OnMounted();
}
also the ChateoApp:
https://github.com/adospace/mauireactor-samples/blob/main/ChateoApp/Chateo/Pages/SettingsPage.cs
essentially, you should create a class that returns your brushes/colors/etc based on the current Theme, attach it to the RequestedThemeChanged event on the OnMounted of the root component (page), and invalidate it.
BTW if you attach RequestedThemeChanged in a component that is not the root be aware to detach it in the Unmount() override
Wow that was fast! Thanks.
if you use XAML styles, take a look at the WeatherTwentyOne https://github.com/adospace/reactorui-maui/tree/main/samples/MauiReactor.WeatherTwentyOne
What would be the best way to use Appthemebinding in MauiReactor