2

I have a Windows Phone 8.1 Silverlight app that changes the Lock Screen wallpaper. I have multiple versions of each wallpaper based on device resolution. For the new Microsoft Lumia 950, which has a QHD screen I have generated images with a resolution of 2560x1440. This corresponds to an aspect ratio of 16:9. Now I used to think that the correct way to programmatically determine the device screen size was the following:

double deviceWidth = Application.Current.Host.Content.ActualWidth * (int)DisplayProperties.ResolutionScale / 100;
double deviceHeight = Application.Current.Host.Content.ActualHeight * (int)DisplayProperties.ResolutionScale / 100;

However, when I debug on my Lumia 950 I see the following:

//deviceHeight = 1200
//deviceWidth = 720  

Furthermore this gives a different aspect ratio of 15:9. I suspect this difference is due to the soft, dismissable navigation bar on the bottom present in Windows 10. The other values I'm seeing are:

//Application.Current.Host.Content.ActualWidth= 480;
//Application.Current.Host.Content.ActualWidth= 800;
// (int)DisplayProperties.ResolutionScale = 150;

It's mentioned here by Microsoft that even:

on a 1080p resolution screen, the ScaleFactor property will return 1.5, although a 2.25x scale is used internally by the OS.

So by this logic the ScaleFactor for QHD should be 3 but again a maximum of 1.5 is returned. Anyone then know of an alternative way of determining screen size of a device? For the moment I'll switch to the RM-1104 code to identify a Lumia 950, although this is impractical since other codes will surely be added later.

Nikson K John
  • 455
  • 5
  • 13
kernanb
  • 566
  • 2
  • 6
  • 19
  • 1
    Maybe you could add some comments here? http://stackoverflow.com/questions/31936154/get-screen-resolution-in-win10-uwp-app could be they have another angle on this? – Depechie Dec 08 '15 at 07:30

0 Answers0