我想知道为什么当我加载我的 windows phone 项目时,应用程序栏出现在我的第一个屏幕上,这只是一个加载背景。
我怎样才能让它出现在加载的真正结束时?
这是我使用的代码:
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);
}
我在这里设置了可见性:
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;
}
}