Search code examples
windows-phone-7panorama-controlapplication-bar

WP7 Panorama control sliding lagging when hiding Application Bar


I have a Windows Phone app with panorama control.

Panorama currently has two pages.

One page should have a visible application bar with buttons, and another one should not.

I use the panorama's SelectionChanged event to chage the IsVisible property of the ApplicationBar.

private void Panorama_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
        {
            ApplicationBar.IsVisible = Panorama.SelectedIndex == 0;
        }

The functionality I get is as desired, but with such behaviour, I get a terrible lagging (a momentary freeze of sliding animation) of my panorama. This probably happens due to the fact that the UI thread has to operate the very windows phone "native" application bar.

What is the best way to avoid this problem?

Should I call the ApplicationBar.IsVisible = Panorama.SelectedIndex == 0; in a separate thread? Or should I use the item's ManipulationStarted and ManipulationCompleted events to hide the app bar?

Thanks.


Solution

  • You should design your application to not use the application bar on the same page as a panorama control.

    The two are not designed to be used together. This is for both design and technical reasons. (Because they should never be used toghether for design reasons, there are technical issues when using them both which are highly unlikley to ever be addressed.) You've found one such issue.

    If you have content on a panorama item that the user should interact with then move the controls onto the item or a separate page (if linked to by selecting that content).

    Update
    Before anyone points out - some of the hubs (office & people) combine panoramas and application bars in the current mango builds. There is no official comment on this from Micorsoft. (I just asked.) Design guidelines for Mango have not yet been released. There is unlikely to be any more info until they are.
    The panorama template with the mango beta SDK still includes a comment indicating that you shouldn't combine an application bar and a panorama though.