Xaml 正在从windows应用商店应用程序的搜索窗格中删除搜索建议
我只想显示应用内搜索中的搜索建议,而不想显示默认情况下在windows应用商店应用的搜索窗格中显示的建议。“搜索”窗格中有默认存在的应用程序,我不想将它们与我的应用程序搜索结果一起显示。在您的搜索页面中,只需添加: 注册事件:Xaml 正在从windows应用商店应用程序的搜索窗格中删除搜索建议,xaml,search,windows-8,windows-rt,Xaml,Search,Windows 8,Windows Rt,我只想显示应用内搜索中的搜索建议,而不想显示默认情况下在windows应用商店应用的搜索窗格中显示的建议。“搜索”窗格中有默认存在的应用程序,我不想将它们与我的应用程序搜索结果一起显示。在您的搜索页面中,只需添加: 注册事件: SearchPane.GetForCurrentView().SuggestionsRequested += OnSuggestionsRequested; void OnSuggestionsRequested(SearchPane sender, SearchPan
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);
}
}
处理建议请求事件:
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);
}
}
在搜索页面中,只需添加: 注册事件:
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);
}
}
处理建议请求事件:
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);
}
}