Get Screen Resolution in Win10 UWP App

As an UWP App runs in window mode on common desktop systems the "old" way of getting the screen resolution won't work anymore.

Old Resolution with Window.Current.Bounds was like shown in.

Is there another way to get the resolution of the (primary) display?


To improve the other answers even a bit more, the following code also takes care of scaling factors, e.g. for my 200% for my Windows display (correctly returns 3200x1800) and 300% of the Lumia 930 (1920x1080).

var bounds = ApplicationView.GetForCurrentView().VisibleBounds;
var scaleFactor = DisplayInformation.GetForCurrentView().RawPixelsPerViewPixel;
var size = new Size(bounds.Width*scaleFactor, bounds.Height*scaleFactor);

As stated in the other answers, this only returns the correct size on Desktop before the size of root frame is changed.


Call this method anywhere, anytime (tested in mobile/desktop App):

public static Size GetCurrentDisplaySize() {
    var displayInformation = DisplayInformation.GetForCurrentView();
    TypeInfo t = typeof(DisplayInformation).GetTypeInfo();
    var props = t.DeclaredProperties.Where(x => x.Name.StartsWith("Screen") && x.Name.EndsWith("InRawPixels")).ToArray();
    var w = props.Where(x => x.Name.Contains("Width")).First().GetValue(displayInformation);
    var h = props.Where(x => x.Name.Contains("Height")).First().GetValue(displayInformation);
    var size = new Size(System.Convert.ToDouble(w), System.Convert.ToDouble(h));
    switch (displayInformation.CurrentOrientation) {
    case DisplayOrientations.Landscape:
    case DisplayOrientations.LandscapeFlipped:
        size = new Size(Math.Max(size.Width, size.Height), Math.Min(size.Width, size.Height));
        break;
    case DisplayOrientations.Portrait:
    case DisplayOrientations.PortraitFlipped:
        size = new Size(Math.Min(size.Width, size.Height), Math.Max(size.Width, size.Height));
        break;
    }
    return size;
}