July 17, 2012  Posted by Iris Classon at 9:42 am Iris' blog, Metro, Metro App Help (code and design), WinRT  Add comments

Following a discussion on the Metro/WinRT mailinglist I’ve decided to share a handy little code snippet. With different screen resolutions, aspect ratios and scaling you might need to display things differently, and maybe you would like to access the resolution and scale details in code/programmatically. Well, it’s actually quite easy:

//
            double height = Windows.UI.Xaml.Window.Current.Bounds.Height;
            double width = Windows.UI.Xaml.Window.Current.Bounds.Width;
            ResolutionScale resolutionScale = DisplayProperties.ResolutionScale;
//

3 comments on “WinRT/Metro App Q n’ A: How do I get the screen resolution and scale?

  1. Pingback: Dew Drop – July 18, 2012 (1,366) | Alvin Ashcraft's Morning Dew

  2. Pingback: Windows 8 Developer Links – 2012-07-19Dan Rigby | Dan Rigby

  3. FacilisDK on said:

    You just saved my day! (again)
    Thank you so much for that snippet! All I could find was way-to-advanced samples.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

HTML tags are not allowed.

What is 6 + 3 ?
Please leave these two fields as-is:
IMPORTANT! To be able to proceed, you need to solve the following simple math (so we know that you are a human) :-)