async void NavigationRootPage_Loaded(object sender, RoutedEventArgs e) { this.DataContext = await ControlInfoDataSource.GetGroupsAsync(); Current = this; RootFrame = rootFrame; }
protected async override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); var _controlInfoDataGroups = await ControlInfoDataSource.GetGroupsAsync(); this.DefaultViewModel["Groups"] = _controlInfoDataGroups; }
private async void LoadGroups() { _groups = await ControlInfoDataSource.GetGroupsAsync(); if (GroupsLoaded != null) { GroupsLoaded(this, new EventArgs()); } }
/// <summary> /// Populates the page with content passed during navigation. Any saved state is also /// provided when recreating a page from a prior session. /// </summary> /// <param name="sender"> /// The source of the event; typically <see cref="NavigationHelper"/> /// </param> /// <param name="e">Event data that provides both the navigation parameter passed to /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and /// a dictionary of state preserved by this page during an earlier /// session. The state will be null the first time a page is visited.</param> private async void navigationHelper_LoadState(object sender, LoadStateEventArgs e) { var controlInfoDataGroups = await ControlInfoDataSource.GetGroupsAsync(); this.DefaultViewModel["Groups"] = controlInfoDataGroups; GroupsHubSection.DataContext = controlInfoDataGroups; // Get every item from every group so you have a list of all items. List <ControlInfoDataItem> items = new List <ControlInfoDataItem>(); foreach (ControlInfoDataGroup group in controlInfoDataGroups) { foreach (ControlInfoDataItem item in group.Items) { items.Add(item); } } // Sort items into an array ordered alphabetically by Title. // This array is used to populate the 'controls by name' GridView. itemsViewSource.Source = items.OrderBy(item => item.Title).ToArray(); }
protected async override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); _groups = await ControlInfoDataSource.GetGroupsAsync(); }