xamarin / Xamarin.Forms

Xamarin.Forms is no longer supported. Migrate your apps to .NET MAUI.
https://aka.ms/xamarin-upgrade
Other
5.62k stars 1.87k forks source link

[Enhancement] Support ‘vw’ and ‘vh’ support for width,height and font size #8537

Closed John0King closed 2 years ago

John0King commented 4 years ago

Summary

When build a mobile page or mobile app using html, normally we use rem , and in Wechat miniprogram use rpx for example

using rem :

we create a simple script to calculate the root element's fontsize (window size X, and rem size 1000) , X / 1000 = rem unit base size , for example , the widow width is 2000, then 1rem = 2px and for div width: 1000 rem = 100% , 900rem = 90%.

using rpx on wechat miniprogram:

wechat team define 1rpx = X / 750, so 750rpx = 100%

by using those we can create full scalable view (scale all the div, image, text ect. ), today xamarin using Grid , StackLayout can only scale the 'box' element , but not the font

Intended Use Case

<Label Text="Title" FontSize="25rpx" WidthRequest="50rpx" HeightRequest="50rpx" />   1000rpx = 100%

it will look the same on every device, every dpi.

John0King commented 4 years ago

html has an official size 'vh' and 'vw', maybe xamarin.forms should support those two unit

jfversluis commented 2 years ago

Thanks for this suggestion! As Xamarin.Forms is now in maintenance mode, this will not happen anymore for Xamarin.Forms. We're only adding bugfixes and stability fixes.

If this is still important to you, make sure to check the .NET MAUI repo and see if it's already on the roadmap. If not, feel free to open a discussion to discuss a change first or open an issue with a detailed feature request. Thanks!