SearchBoxSuggestionsRequestedEventArgs 클래스

정의

SearchBox.SuggestionsRequested 이벤트에 대한 이벤트 데이터를 제공합니다.

public ref class SearchBoxSuggestionsRequestedEventArgs sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class SearchBoxSuggestionsRequestedEventArgs final
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class SearchBoxSuggestionsRequestedEventArgs final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class SearchBoxSuggestionsRequestedEventArgs
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class SearchBoxSuggestionsRequestedEventArgs
Public NotInheritable Class SearchBoxSuggestionsRequestedEventArgs
상속
Object Platform::Object IInspectable SearchBoxSuggestionsRequestedEventArgs
특성

Windows 요구 사항

디바이스 패밀리
Windows 10 (10.0.10240.0에서 도입되었습니다.)
API contract
Windows.Foundation.UniversalApiContract (v1.0에서 도입되었습니다.)

예제

SuggestionsRequested 이벤트에 비동기적으로 응답하려면 제안 목록을 편집하기 전에 SearchSuggestionsRequestDeferral 개체를 가져와야 합니다. 방법을 보여 주는 예제는 다음과 같습니다.

public async static void SearchBox_SuggestionsRequested(
    SearchBox sender, 
    SearchBoxSuggestionsRequestedEventArgs args)
{

    // This object lets us edit the SearchSuggestionCollection asynchronously. 
    var deferral = args.Request.GetDeferral();

    try { 

        // Retrieve the system-supplied suggestions.
        var suggestions = args.Request.SearchSuggestionCollection;

        var groups = await SampleDataSource.GetGroupsAsync();
        foreach (var group in groups)
        {
            var matchingItems = group.Items.Where(
                item => item.Title.StartsWith(
                    args.QueryText, StringComparison.CurrentCultureIgnoreCase));

            foreach (var item in matchingItems)
            {
                suggestions.AppendQuerySuggestion(item.Title);
            }
        }

        foreach (string alternative in args.LinguisticDetails.QueryTextAlternatives)
        {
            if (alternative.StartsWith(
                args.QueryText, StringComparison.CurrentCultureIgnoreCase))
            {
                suggestions.AppendQuerySuggestion(alternative); 
            }
        }
    }
    finally {
        deferral.Complete();
    }

}

설명

중요

SearchBox는 범용 디바이스 패밀리에 구현되어 있지만 모바일 디바이스에서 완전히 작동하지 않습니다. 유니버설 검색 환경에 AutoSuggestBox를 사용합니다. AutoSuggestBox를 위해 더 이상 사용되지 않는 SearchBox를 참조하세요.

속성

Language

현재 사용자의 텍스트 입력 디바이스와 연결된 언어를 식별하는 IETF(Internet Engineering Task Force) 언어 태그(BCP 47 표준)를 가져옵니다.

LinguisticDetails

사용자가 IME(입력 방법 편집기)를 통해 입력하는 쿼리 텍스트에 대한 정보를 가져옵니다.

QueryText

현재 검색의 쿼리 텍스트를 가져옵니다.

Request

이 요청에 대한 제안 및 정보를 저장하는 개체를 가져옵니다.

적용 대상

추가 정보