简体   繁体   中英

Accessing applicataion bar from non UI class windows phone 8

In my windows phone app I've a non-UI class which will show and hide a pop up screen when called from the UI page.

I want to hide the application bar when the pop up is shown and show the appbar again when the pop up is closed.

Now the challenge here is I've a timer in the non UI class which handles the closing of the pop up. So from the UI class I can only start the pop up. Closing is controlled by the non UI class. So now I need to access the appbar from the non UI class.

Can any one help me if I can do it or any work around if this cannot be done. ?

Thank you.

Maybe making use of Popup.Closed Event would help:

private void myPopup_Close(object sender, System.EventArgs e)
{
   // get current Page
   var currentPage = ((App.Current as App).RootVisual as PhoneApplicationFrame).Content as PhoneApplicationPage;
    // hide popup
    currentPage.ApplicationBar.IsVisible = true;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM