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

This blog post will guide you through several effective methods to troubleshoot and resolve the issue of Microsoft Edge not...
Windows 11 offers a range of audio enhancements that can enrich your listening experience. These enhancements include features like virtual...
Windows 11 brings a fresh and visually stunning design to your desktop, and one of the standout features is the...