I am running into issue and would appreciate expert’s help here. I am trying to get screen resolution so that I can use appropriate layouts/images based on phone types.
My project type is WP7. Whenever I run code on different WP7 and WP8 devices, I get the same resolution everytime (800 X 480). Expected behavior is I get different resolution based on device type e.g. WVGA = 800 x 480, WXGA = 1280 x 768, 720p = 1280 x 720.
All the 3 code snippets below gave me same resolution of 800 X 480 which is not expected behavior.
Application.Current.RootVisual.RenderSize.Height + " x " + Application.Current.RootVisual.RenderSize.Width;
(App.Current.RootVisual as FrameworkElement).ActualHeight + " x " + (App.Current.RootVisual as FrameworkElement).ActualWidth;
App.Current.Host.Content.ActualHeight + " x " + App.Current.Host.Content.ActualWidth;
The MSDN article talks about how to do this in WP8 but please note that I want code to run on WP7 device as well.