Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get a screen resolution of Device (Windows Phone)

How can I get a screen resolution of Device from settings (Windows Phone) ?

like image 582
revolutionkpi Avatar asked Mar 24 '12 14:03

revolutionkpi


2 Answers

public void GetScreenResolution()  
{  
     string ScreenWidth = Application.Current.Host.Content.ActualWidth.ToString();  
     string ScreenHeight = Application.Current.Host.Content.ActualHeight.ToString();  
     MessageBox.Show(ScreenWidth + "*" + ScreenHeight);  
}  
like image 92
Dmitry Reznik Avatar answered Oct 06 '22 01:10

Dmitry Reznik


This may be a better way to know what screen resolution is your app running on.

if(App.Current.Host.Content.ScaleFactor == 100)
{
  // WVGA
}
else if (App.Current.Host.Content.ScaleFactor == 160)
{
  // WXGA
}
else if (App.Current.Host.Content.ScaleFactor == 150)
{
  // 720p
}

Source http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj206974%28v=vs.105%29.aspx

like image 45
Paras Wadehra Avatar answered Oct 06 '22 00:10

Paras Wadehra