A Microsoft platform for building and publishing apps for Windows devices.
Hello @Shikhar Jain ,
Welcome to Microsoft Q&A!
Is there any API which will allow me to collect the screen resolution of the TV/Monitor?
If your app is not running in full-screen mode, you might need to get the display device instead and gets the native resolution.
You could try to use DeviceInformation.CreateWatcher method to enumerate all the display devices and create DisplayMonitor Class for the display class. Then you could check the NativeResolutionInRawPixels property of DisplayMonitor object to get the native resolution.
I made a simple test on my side on a PC, not an Xbox(because we don't have an Xbox here.). It should work on Xbox as well. Here is the code snippet:
var deviceSelector = DisplayMonitor.GetDeviceSelector();
var devices = await DeviceInformation.FindAllAsync(deviceSelector);
foreach (var device in devices)
{
Debug.WriteLine("Kind: {0} Name: {1} Id: {2}", device.Kind, device.Name, device.Id);
DisplayMonitor displayMonitor = await DisplayMonitor.FromInterfaceIdAsync(device.Id);
Debug.WriteLine("resolution: " + displayMonitor.NativeResolutionInRawPixels.Width + " x " + displayMonitor.NativeResolutionInRawPixels.Height);
}
Thank you.
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.