locked
[Win 8.1] [c#] confusing device resolutions in windows simulator RRS feed

  • Question

  • i have an app & i am trying to resize it basing on target device resolution (width & height) , but when i observed in windows simulator the resolution 10.6" 2560X1440 (16:9) (180%)  is present, when i ran the debugger & saw the height is showing as 1368 instead of 1440 & width is showing correctly as 2560 , why there is this difference, how to exactly pin down the target device width & height bounds ?? are the resolutions shown in windows simulator are the only resolutions present outside (or) are there many other kinds of resolutions ? , please clarify me. 
    Tuesday, July 12, 2016 2:01 PM

Answers

All replies

  •  Hi kranthi88,

    >>when i ran the debugger & saw the height is showing as 1368 instead of 1440 & width is showing correctly as 2560  

    What is the API you used for getting the height and width?  As far as I known in win8.1, there is no API can get the screen resolution directly. We also get the window's size by the "Windows.Bound" property, and code example as follows: 

    var bounds = Window.Current.Bounds;
    double height = bounds.Height;
    double width = bounds.Width;

    By using these code, I can get the same result as you in my local machine. My resolution is 1920*1080, the width and height I got from the above code is 1920*1008,  width is same with the resolution but height is less than the resolution's height. This is because the height and width are the application window's , not the screen's. Sometimes we had a toolbar in the bottom of the screen. This is why you got 1368 instead of 1440. 

    >>how to exactly pin down the target device width & height bounds ?? 

    There is no API can get the screen resolution in win8.1. But in UWP you can get it by the ApplicationView.VisibleBounds property:

     var bounds = ApplicationView.GetForCurrentView().VisibleBounds;
    In win8.1 you can get the DPI by DisplayInformation class.


    Best Regards, Sunteen Wu



    • Edited by Sunteen Wu Wednesday, July 13, 2016 7:33 AM
    Wednesday, July 13, 2016 7:32 AM
  • my app runs on windows 10 but built using VS 2013 (it's primarily a windows 8.1 app), which solution do you recommend in my case ? also please give me the list of screen sizes that windows 10 support currently.
    • Edited by kranthi88 Thursday, July 14, 2016 7:49 AM
    Wednesday, July 13, 2016 11:06 AM
  • Hi kranthi88,

    Since your purpose is to know what is the biggest size your app can be in this device, in my mind, if you can turn to develop a UWP app, of course using the property  ApplicationView.VisibleBounds  is the best way. If you still develop a windows 8.1 app, the Windows.Bound property is enough for you to get the biggest window's size. Although it is smaller than the screen size, but what you cared is the window's size.

    For the screen sizes of windows10 please reference :https://msdn.microsoft.com/en-us/windows/uwp/layout/screen-sizes-and-breakpoints-for-responsive-design


    Best Regards, Sunteen Wu


    • Edited by Sunteen Wu Friday, July 15, 2016 2:20 PM
    • Proposed as answer by Sunteen Wu Wednesday, July 20, 2016 7:07 AM
    • Marked as answer by Barry Wang Thursday, July 21, 2016 9:07 AM
    Friday, July 15, 2016 2:18 PM