我想知道为什么当我加载我的Windows手机项目时,应用程序栏出现在我的第一个屏幕上,这只是一个加载背景..
如何让它显示在加载的最后。
这是我使用的代码。
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;
}
}
答案 0 :(得分:4)
在this.ApplicationBar.IsVisible = true;
事件处理程序中_worker.RunWorkerCompleted
而不是Loaded
事件