Retrieve the screen resolution of Windows Phone 7 using c#

The Current Windows Phone 7 devices provides the screen resolution of 480 X 800 pixels . Microsoft might introduce another resolution (320×480 ) .

It is easier to find this resolution via the WP7 SDK.

You can retrieve this screen resolution from the Windows Phone via the Current.Host.Content defined in the Application Class of System.Windows namespace .

This includes the properties to retrieve the actual height and actual width which gives 800 and 480 respectively.

using System.Windows;
public void GetScreenResolution()

{

     string ScreenWidth = Application.Current.Host.Content.ActualWidth.ToString();

     string ScreenHeight = Application.Current.Host.Content.ActualHeight.ToString();

     MessageBox.Show(ScreenWidth + "*" + ScreenHeight);

}

The Windows Phone Emulator uses the resolution 800 x 480. And hence when the above example function is used to test on the emulator, you should see the below.

    1 Comment

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

In this post, you will learn about sync provider notifications in Windows 11 and how to disable or enable it...
In this tutorial, let’s learn how to enable or disable the startup sound in Windows 11. By default, when Windows...
The CameraCaptureTask allows the Windows Phone 7 App to launch the Camera Application . This will be useful when the...