문제

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); }
    }
도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top