I've settled on using the built-in Device Styles for now.
Responding to Dynamic Text changes at runtime

I'm working on adding some better accessibility support to a Xamarin.Forms application, including font scaling. For test purposes, I have made a new solution with a very simple layout:
<StackLayout Padding="20">
<Label Text="Small" FontSize="Small"/>
<Label Text="Medium" FontSize="Medium"/>
<Label Text="Large" FontSize="Large"/>
<Label Text="BodyStyle" Style="{DynamicResource BodyStyle}"/>
<Label Text="Font Size 24" FontSize="24"/>
</StackLayout>
On Android, when I go to Settings, change the font size, and return to the app, all 5 labels change in response to the accessibility settings. On iOS, only the BodyStyle changes unless I swipe-kill and reopen the app. Is there an AppDelegate override or something I can add so I can respond to accessibility changes without killing the app or needing dynamic resources for everything?
Developer technologies | .NET | Xamarin
1 additional answer
Sort by: Most helpful
-
Cole Xia (Shanghai Wicresoft Co,.Ltd.) 6,756 Reputation points
2021-04-16T07:56:40.253+00:00 Hello,
Welcome to Microsoft Q&A!
You can simply use the following code in iOS project to detect when the accessibility settings has been changed .
Foundation.NSObject observerToken = UIApplication.Notifications.ObserveContentSizeCategoryChanged( (s, e) => { //use messaging center });
Then you can send message to forms project to rebuild your UI.
If the response is helpful, please click "Accept Answer" and upvote it.
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.