简体   繁体   中英

ApplicationBar WP7

I am wondering why when I load my windows phone project, the application bar is appearing on my first screen which is just a loading background.

How can I make it appear at the really end of the loading?

This is the code I use:

public MainPage()
    {
        InitializeComponent();

        AnimationContext = LayoutRoot;  //  for page transitions
        _tappedListBox = null;   //  used for setting the activated ListBox on panorama for animation to map page

        // If the constructor has been called, this is not a page that was already in memory:
        _newPageInstance = true;

        //  Setup the background thread worker properties:
        _worker = new BackgroundWorker();   //  Create a background thread worker for downloading/installing park maps
        _worker.WorkerReportsProgress = true;
        _worker.WorkerSupportsCancellation = true;
        _worker.DoWork += new DoWorkEventHandler(worker_DoWork);
        _worker.ProgressChanged += new ProgressChangedEventHandler(worker_ProgressChanged);
        _worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(worker_RunWorkerCompleted);

        // Set the data context of the listbox control to the sample data
        this.DataContext = App.ViewModel;
        this.Loaded += new RoutedEventHandler(MainPage_Loaded);


    }

And I set the visibility here:

    private void MainPage_Loaded(object sender, RoutedEventArgs e)
    {
        if (!App.ViewModel.IsDataLoaded)
            App.ViewModel.LoadData();
        ;   //  load panorama data (if need to)

        if (!App.ViewModel.IsDataLoaded == false)
        {
            this.ApplicationBar.IsVisible = true;
        }
    }

Pu it this.ApplicationBar.IsVisible = true; inside _worker.RunWorkerCompleted event handler instead of Loaded event

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