Dynamic font size per screen size and platform

Hi,

I am trying to have a slight change in the font size based on the screen size and per platform UWP, Android and iOS.

Could you please let me know how I could achieve this with an example/ sample with a change in the font size based on the screen size and per platform UWP, Android and iOS?

mainScale.LabelFontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label));

I'm targetting pcs, tab and mobiles.

Thank you.

Warm regards,
John

3 Replies

SG Sri Gayathri Gopalakrishnan Syncfusion Team June 18, 2018 10:33 AM UTC

Hi John, 
 
Query: Dynamic font size per screen size and platform  
 
We have analyzed your query, FontSize can be changed based on the Platform and the Device types. Added the OnPlatform in the sample for Scale LabelFontSize. Please find the code snippet and sample from the below link, 
 
<gauge:Scale.LabelFontSize> 
                    <OnPlatform x:TypeArguments="x:Double"> 
                        <OnPlatform.WinPhone> 
                            <OnIdiom x:TypeArguments="x:Double" Desktop="25" Phone="20" Tablet="25"/> 
                        </OnPlatform.WinPhone> 
                        <OnPlatform.Android> 
                            <OnIdiom x:TypeArguments="x:Double" Phone="20"  Tablet="25" /> 
                        </OnPlatform.Android> 
                        <OnPlatform.iOS> 
                            <OnIdiom x:TypeArguments="x:Double"  Phone="20"  Tablet="25" /> 
                        </OnPlatform.iOS> 
                    </OnPlatform> 
                </gauge:Scale.LabelFontSize> 
 
 
 
Screenshot
 
 
 
Regards, 
Sri Gayathri. G 



JS John Stephen Mangam June 18, 2018 10:58 AM UTC

Hi Gayathri,

thank you for the information and for the sample.

Could you please let me know how I could vary the font size based on the screensize? are there any screensizes that we can target within mobile?

Thanks and regards,
John


SG Sri Gayathri Gopalakrishnan Syncfusion Team June 19, 2018 12:06 PM UTC

 
Query: how I could vary the font size based on the screen size 
 
We have analyzed your query and prepared sample to adjust font size based on screen size in SizeChangedEvent. In SizeChanged event, screen size can be determined and added logic as control size 500, font size 14 has been set. The ratio of font size can be changed based on your needs. Please download the sample from the below link, 
 
 
Regards, 
Sri Gayathri. G  


Loader.
Up arrow icon