我有WP7银灯,显示使用Pivot的一组数据。 在首次创建该项目时,视频演播室模板称为Gis Model。 LoadData, p. 1. Loaded:
private void MainPage_Loaded(object sender, RoutedEventArgs e)
{
App.ViewModel.LoadData();
}
然而,onMSDN 它说,你应当使用OnNavigated To,而不是第_Loaded页,因为OnNavigated 只有在一页起作用时,才叫到,而“Loaded”页则每当页的视觉树上添加一个物品。 MSDN条款是关于银灯4,而不是用于银灯窗。
You override the OnNavigatedTo method to examine the navigation request and prepare the page for display. For example, you can load the requested data and enable or disable visual elements.
Typically, you use the OnNavigatedTo method instead of creating an event handler for the Loaded event. The OnNavigatedTo method is preferable because it is only called once for each time the page becomes active. The Silverlight framework raises the Loaded event each time the element is added to the visual tree, which potentially can happen more than once when activating a page. The OnNavigatedTo method is called for each request, even when the page is retrieved from the cache. You should include in this method code that must be executed for each request rather than placing that code in the Page constructor.
是否有任何原因,为什么演练室视像素帕夫模板叫GisModel。 LoadData in page_Loaded?