Search code examples
windows-phone-8windows-phonegdr

How to get Screen size of a windows phone 8 device?


I was searching for how can i get the Actual screen size of a windows phone 8 device , i've found this method but it work only with Devices With GDR3 update


Solution

  • UPDATED : i've found this method

    private void getScreenInfo() 
    {
        double dpix = -1.01;
        double screensize = -1.01;
        double dpiy = -1.01;
        Size res;
        try {
            dpix = (double)DeviceExtendedProperties.GetValue("RawDpiX");
            dpiy = (double)DeviceExtendedProperties.GetValue("RawDpiY");
            res = (Size)DeviceExtendedProperties.GetValue("PhysicalScreenResolution");
            screensize = Math.Sqrt(Math.Pow(res.Width / dpix, 2) + Math.Pow(res.Height / dpiy, 2));
        }
        catch (Exception e) {
        }
    }