How to Get Screen Resolution in Win10 UWP App

This sample demonstrates how to get resolution in UWP app.

C# (171.7 KB)
517 times
Add to favorites
E-mail Twitter Digg Facebook
Sign in to ask a question

  • The code gets app window resolution, not screen resolution
    1 Posts | Last post February 10, 2018
    • Tested the code with a UWP app running on W10 1709.  It gets the app's window resolution, not the screen resolution.
  • Screen resolution issue
    1 Posts | Last post December 12, 2016
    • Thanks for this App.
      I have 4k susyem and I am trying to test 4k resolution on my UWP App. The maximum rectangle size I can get is 1280x640. The code in XAML is
          <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
              <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
                  <Rectangle Width="1280" Height="640" Fill="Beige"/>
      I tried to do google but did not help much, then I found your app and it shows me correct screen resolution 3840x2160. 
      Can you please let me know what I am missing here? Do I have to configure something?
  • Screen res no long works on 14393?
    2 Posts | Last post October 14, 2016
    • Hello,
      I tried this sample on 14393 SDK. 
      The screen resolution shown is just the initial windows size. 
      It seems like Microsoft has changed the logic behinds for 14393 because I can confirm this method was working in 10240 and 10586 SDK in my own app. 
      Is there any new API or class added in the anniversary update that can get the screen size reliably? I was thinking jumping to full-screen mode and get so but it sounds ugly.
      Leo Chan
    • Just found the DisplayInformation.GetForCurrentView().ScreenHeightInRawPixels