Question

How to change in windows phone the systemtray in portrait to show up and on landscape to hide?!

i have something like this now but it dont work:

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

on the xaml page the shell:systemtray.isvisible="true" and it dont work. if i remove the visiblity from systemtray in xaml it is not shown at all.

i fixed it, it was an little bug in my code, i had to use PhoneApplicationPage_BeginLayoutChanged instead of Pregled_OrientationChanged i thought i can set the event handler name like i want... my mistake.

Était-ce utile?

La solution

This code made it to work...

private void PhoneApplicationPage_BeginLayoutChanged (object sender, OrientationChangedEventArgs e)
{
    if (e.Orientation == PageOrientation.PortraitUp)
    {
        SystemTray.IsVisible = true;
    }
    else
    {
        SystemTray.IsVisible = false;
    }
}
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top