Stopping notification bar to popup during game play

流过昼夜 提交于 2019-12-03 16:06:22

To hide the notification bar, you need to do two things:

  1. Set your application as full screen
  2. Hide the system tray in your pages

You can set your application as full screen by changing the FullScreen property of your RootFrame. This can be done for instance in the App constructor, in the App.xaml.cs file:

public App()
{
    // Global handler for uncaught exceptions.
    UnhandledException += Application_UnhandledException;

    // Standard XAML initialization
    InitializeComponent();

    // Phone-specific initialization
    InitializePhoneApplication();

    // Hide the notification bar
    // Note: this must be done *after* InitializePhoneApplication
    RootFrame.FullScreen = true;

    // Language display initialization
    InitializeLanguage();
}

Then, you also have to hide the system tray on your pages, by setting the SystemTray.IsVisible property. This can be done either in the C# code or in the XAML:

<phone:PhoneApplicationPage
    x:Class="SL8._1.MainPage"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    shell:SystemTray.IsVisible="False">
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!