2013-01-11 63 views

回答

1

在搜索頁面只需添加:

註冊事件:

SearchPane.GetForCurrentView().SuggestionsRequested += OnSuggestionsRequested; 

手柄建議請求事件:

void OnSuggestionsRequested(SearchPane sender, SearchPaneSuggestionsRequestedEventArgs args) 
{ 
    string query = args.QueryText.ToLower(); 
    string[] terms = { "salt", "pepper", "water", "egg", "vinegar", "flour", "rice", "sugar", "oil" }; 

    foreach(var term in terms) 
    { 
     if (term.StartsWith(query)) 
      args.Request.SearchSuggestionCollection.AppendQuerySuggestion(term); 
    } 
}