Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stopping notification bar to popup during game play

Context: I am working on a windows phone game using XNA 4.0 framework. During the gameplay, if the user accidentally drags the top of screen, notification center gets dragged down.

I have seen few apps where this behaviour is overridden and instead of notification center popping up, a small cue is shown at the top as shown in the screenshot below.

Question: What is the API that stops notification center to come up when user accidentally drags the top of screen during gameplay?

Screenshot of what I want to achieve:

notification center cue at the top

Same question asked on WP forum also but waiting for correct solution.

like image 581
monish001 Avatar asked Oct 21 '22 07:10

monish001


1 Answers

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">
like image 61
Kevin Gosse Avatar answered Oct 23 '22 21:10

Kevin Gosse