Reputation: 4192
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;
}
}
Upvotes: 0
Views: 409
Reputation: 8126
Pu it this.ApplicationBar.IsVisible = true;
inside _worker.RunWorkerCompleted
event handler instead of Loaded
event
Upvotes: 4