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?
Call this method anywhere, anytime (tested in mobile/desktop App):
The more simple way:
This does not depends on current view size. At any time it returns real screen resolution.
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).
As stated in the other answers, this only returns the correct size on Desktop before the size of root frame is changed.
Use this method to get the screen size:
You should call this method from App.xaml.cs, after Window.Current.Activate(); in OnLaunched method.
Here's the sample code and you can download the full project.
Okay so the Answer from Juan Pablo Garcia Coello lead me to the Solution - Thanks for that!
You can use
but you must call it before the windows is displayed in my case right after
is a good place. At this time you will get the bounds of the window on which your app will appear.
Thanks a lot for help me solving it :)
Regards Alex
The only way I found is inside the constructor of a Page:
I have not tested in Windows 10 Mobile, when the new release appears I will test that.