Hello,
how to scale labels and buttons fontsize according to resolution or width of page on windows platform? like percentage?
Maui does not have scale font size like percentage. You can open a feature request in the MAUI GitHub repo.
You can set FontSize in c# (code behind), based on screen size like following code.
protected override void OnAppearing()
{
base.OnAppearing();
#if WINDOWS || MACCATALYST
var res = DeviceDisplay.Current.MainDisplayInfo.Width;
if (res > 1920) {
myLabel.FontSize = 60f;
}
#endif
}
Best Regards,
Leon Lu
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.