Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/search/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xaml 正在从windows应用商店应用程序的搜索窗格中删除搜索建议_Xaml_Search_Windows 8_Windows Rt - Fatal编程技术网

Xaml 正在从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

我只想显示应用内搜索中的搜索建议,而不想显示默认情况下在windows应用商店应用的搜索窗格中显示的建议。“搜索”窗格中有默认存在的应用程序,我不想将它们与我的应用程序搜索结果一起显示。

在您的搜索页面中,只需添加:

注册事件:

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);
    }
}