Search code examples
c#windows-phone-8windows-phoneapplication-bar

WP8 Applicationbar hidding on rotation change


I have this kind of code in my app to hide the SystemTray, and i cant do this same for the Applicationbar. Why? I want to change the isVisible property on rotation change.

This is the code:

private void PhoneApplicationPage_BeginLayoutChanged(object sender, OrientationChangedEventArgs e)
    {
        if (e.Orientation == PageOrientation.PortraitUp)
        {
            AppBar.IsVisible = true;
            SystemTray.IsVisible = true;
        }
        else
        {
            AppBar.IsVisible = false;
            SystemTray.IsVisible = false;
        }
    }

I named the applicationbar to AppBar but i cant change this property, i tried to look whats wrong and on debugging i see the value for AppBar is null, why?

Is there any other method so i can hide it on roation change?! Am i doing something wrong? Because this method wroks for hiding the SystemTray


Solution

  • Let's just be nice and say that ApplicationBar is a funny little creature :) Have you tried accessing it on your page this way?

    this.ApplicationBar.IsVisible = true;