/// <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="navigationParameter">The parameter value passed to /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested. /// </param> /// <param name="pageState">A dictionary of state preserved by this page during an earlier /// session. This will be null the first time a page is visited.</param> protected override void LoadState(Object navigationParameter, Dictionary <String, Object> pageState) { var query = (String)navigationParameter; var list = NotesDataSource.Search(query); this.pageTitle.Text = string.Format("Results for \"{0}\"", query); var nb = new NoteBook(); foreach (NoteDataCommon note in list) { switch (note.Type) { case DataModel.NoteTypes.Food: nb.FoodSection.Add(note); break; case DataModel.NoteTypes.ToDo: nb.ToDoSection.Add(note); break; default: nb.NotesSection.Add(note); break; } } this.DefaultViewModel["Groups"] = nb.Sections; }
/// <summary> /// Return Search results based on search value /// </summary> /// <param name="sender"></param> /// <param name="args">SearchPaneSuggestionsRequestedEventArgs contains QueryText of the search value</param> void SearchPaneSuggestionsRequested(SearchPane sender, SearchPaneSuggestionsRequestedEventArgs args) { var items = NotesDataSource.Search(args.QueryText); foreach (NoteDataCommon item in items) { args.Request.SearchSuggestionCollection.AppendQuerySuggestion(string.Format("{0}{1}{2}", item.NoteBook.Title, Consts.SearchSplitter, item.Title)); } }