I want to access the DisplayInformation
class from a background task in my UWP that takes an image and resizes it from its native resolution to the size of the user's screen, so that it can be set as a wallpaper.
However, when I attempt to use DisplayInformation.GetForCurrentView()
, an exception is thrown, saying that the method must be called from a thread associated with a CoreWindow
. How can I avoid this?
Any solution will work as long as it will give me the complete width and height of the user's screen in raw pixels.