WinRT/Metro App Q n’ A: How do I get the screen resolution and scale?
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;
Last modified on 2012-07-17