Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

How to get the device resolution to optimise for small screens (iPhone) and Phablets (Lumia 1520)

$
0
0

For example, I am creating some forms and I have 3 devices to test => iPhone 5c (640 x 1136 pixels), Lumia 1520 (1080 x 1920 pixels) and Moto G ( 720 x 1280 pixels).

Example of code :

var slEmail = new StackLayout()
{
    Orientation = StackOrientation.Horizontal,

    Children = 
    { 
        new Label
        {
            Text = "Email",
            WidthRequest = 100
        }, 
        new Entry
        {
            Text = "firstname.lastname@longdomainname.com",
            WidthRequest = 200
        }
    }
};

I have tried to add HorizontalOptions, Scale, MinimumWidthRequest etc.. but it's not very good with iPhone 5c (sometimes truncated) and Lumia 1520 (screen a bit empty)..

If I could use something like that, It could be easier for me to optimise :

WidthRequest =  ( (Device.ScreenWidth<800) ? 200 : 350 )

Is there a way to get the height and width of the screen ?


Viewing all articles
Browse latest Browse all 58056

Trending Articles