Hello,
This is because when a Resource is set, its scope is limited to the current page.
You can save the resource key to the Preferences
class in MAUI and load the dynamic resource in the OnDisplaying method of the TaskPage.
Please refer to the following documentation and code:
Write Preferences.Default.Set("FontSizeKey", "Your_Resource_Key");
to the method that changes the fontsize.
Read dynamic resources when the taskpage loads:
protected override void OnAppearing()
{
base.OnAppearing();
var size = Preferences.Default.Get("FontSizeKey", "Unknown");
if (!size.Equals("Unknown"))
{
Resources["FS"] = App.Current.Resources[size];
}
}
Best Regards,
Alec Liu.
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.