在 Windows 10 移动版中是否有隐藏 NavigationBar 的事件? [英] Is there an event for hiding for NavigationBar in Windows 10 Mobile?

查看:19
本文介绍了在 Windows 10 移动版中是否有隐藏 NavigationBar 的事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的场景中,我需要在隐藏 Window 10 Mobile 中的 NavigationBar 时收到通知.有什么办法可以找出 Window 10 Mobile 中 NavigationBar 的可见性变化吗?

问候,斯里尼瓦桑

解决方案

刚刚测试了一下,在 Windows 10 mobile 上,我们只能让应用以全屏模式运行以隐藏导航栏,但问题是当应用处于全屏模式,顶部的状态栏也会隐藏.

所以如果你想让你的应用以全屏模式启动,你可以在 OnLaunched 方法中:

ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.FullScreen;

如果你想在应用程序运行时进入/存在全屏模式,例如你可以在按钮点击事件代码中这样:

private void Button_Click(object sender, RoutedEventArgs e){ApplicationView 视图 = ApplicationView.GetForCurrentView();bool isInFullScreenMode = view.IsFullScreenMode;如果(isInFullScreenMode){view.ExitFullScreenMode();}别的{view.TryEnterFullScreenMode();}}

<块引用>

有什么办法可以找出 Window 10 Mobile 中 NavigationBar 的可见性变化吗?

是的,如果您使用这种全屏模式隐藏导航栏,您可以添加 VisibleBoundsChanged 像这样:

ApplicationView.GetForCurrentView().VisibleBoundsChanged += OnVisibleBoundsChanged;

然后您可以在 OnVisibleBoundsChanged 事件中完成您的工作:

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

AFAIK,暂时没有其他方法可以隐藏导航栏,所以这个方法应该可以解决您的问题,但是该方法不起作用,您可以发表评论告诉我们您是如何隐藏导航栏的.

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

解决方案

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.

这篇关于在 Windows 10 移动版中是否有隐藏 NavigationBar 的事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆