locked
Can I get the current resolution from Metro side? RRS feed

  • Question

  • Is there a way to get the user's current resolution from a Metro Application or a C# Metro Library?

    Thanls

    Pablo

     
    Wednesday, July 11, 2012 7:42 PM

Answers

  • It depends on what you mean by "Resolution". Take a look at Windows.Graphics.Display.DisplayProperties.logicalDPI and resolutionScale properties. There is no direct way to get the width and height of the screen, but you can approximate it by getting the bounds of your CoreWindow.

    --Rob

    Thursday, July 12, 2012 12:43 AM
    Moderator

All replies

  • It depends on what you mean by "Resolution". Take a look at Windows.Graphics.Display.DisplayProperties.logicalDPI and resolutionScale properties. There is no direct way to get the width and height of the screen, but you can approximate it by getting the bounds of your CoreWindow.

    --Rob

    Thursday, July 12, 2012 12:43 AM
    Moderator
  • Thanks Rob, I will try it and let you know.
    Thursday, July 12, 2012 1:03 AM
  • What exactly do you need it for? If you're trying to get the total screen dimensions, then you're limited in that. If you're just trying to know how big your window is, that's easy. In JavaScript you can just use the dimensions of the body element (clientHeight, clientWidth, I believe, or offsetHeight, offsetWidth), or that of an element that's 100% height and width of the body. You can get the scaling factor as Rob explains if you want to figure out the physical dimensions, but it all depends on what you're trying to accomplish with this data.
    Thursday, July 12, 2012 4:23 AM
  • I need it for a specific feature of the application. I need to send the user's screen resolution.
    Thursday, July 12, 2012 1:50 PM