Reputation: 2834
Application.Current.Host.Content.ActualHeight
contains 800, the actual screen height in pixels. I'd like to know how many of these pixels are used by the status bar for whatever device is running our app. Anybody know how to get that value?
Update-
Added these to my PhoneApplicationPage
int _statusBarThicknessPortrait = 32;
int _statusBarThicknessLandscape = 72;
PageOrientation[] portraitOrientations = { PageOrientation.Portrait, PageOrientation.PortraitDown, PageOrientation.PortraitUp };
bool PortraitOrientation {
get { return portraitOrientations.FirstOrDefault(x => x == Orientation) != PageOrientation.None; }
}
double AppWidth {
get { return Application.Current.Host.Content.ActualWidth - (PortraitOrientation ? 0 : _statusBarThicknessLandscape); }
}
double AppHeight {
get { return Application.Current.Host.Content.ActualHeight - (PortraitOrientation ? _statusBarThicknessPortrait : 0); }
}
Upvotes: 1
Views: 1926
Reputation: 35881
It's a fixed value. From http://msdn.microsoft.com/en-us/library/windowsphone/design/hh202905(v=vs.105).aspx#BKMK_Statusbar
The Status Bar grows from 32 pixels in portrait view to 72 pixels in both landscape views, as measured from the side of the phone that has the power button toward the center of the screen.
Upvotes: 3