Is there an event for hiding for NavigationBar in Windows 10 Mobile?

别来无恙 提交于 2020-01-05 05:29:05

问题


In my scenrio, I need to get notification while hiding the NavigationBar in Window 10 Mobile. Is there any way to find out the visibility change of the NavigationBar in Window 10 Mobile?

Regards, Srinivasan


回答1:


Just have a test, it seems on Windows 10 mobile, we can only make the app run in full screen mode to hide the Navigation bar, but problem is when the app is in full screen mode, the status bar in the top will also be hidden.

So if you want to make your app be launched in full screen mode, you can in the OnLaunched method:

ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.FullScreen;

If you want to enter/ exist the full screen mode when the app is running, for example you can in a Button click event code like this:

private void Button_Click(object sender, RoutedEventArgs e)
{
    ApplicationView view = ApplicationView.GetForCurrentView();

    bool isInFullScreenMode = view.IsFullScreenMode;

    if (isInFullScreenMode)
    {
        view.ExitFullScreenMode();
    }
    else
    {
        view.TryEnterFullScreenMode();
    }
}

Is there any way to find out the visibility change of the NavigationBar in Window 10 Mobile?

Yes, if you used this full screen mode method to hide the navigation bar, you can add handler of VisibleBoundsChanged like this:

ApplicationView.GetForCurrentView().VisibleBoundsChanged += OnVisibleBoundsChanged;

Then you can do your work in the OnVisibleBoundsChanged event:

private void OnVisibleBoundsChanged(ApplicationView sender, object args)
{
    //TODO:
}

AFAIK, there is no other way to hide navigation bar for now, so this method should solve your problem, but the method doesn't work, you can leave a comment to tell us how did you hide the navigation bar.



来源:https://stackoverflow.com/questions/39267144/is-there-an-event-for-hiding-for-navigationbar-in-windows-10-mobile

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!