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

SMouligneauxSMouligneaux USUniversity ✭✭
edited July 2014 in Xamarin.Forms

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 = "[email protected]",
            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 ?

Posts

Sign In or Register to comment.