SearchPaneQueryLinguisticDetails class

SearchPaneQueryLinguisticDetails class

Provides information about query text that the user enters through an Input Method Editor (IME).

Syntax


public sealed class SearchPaneQueryLinguisticDetails

Members

The SearchPaneQueryLinguisticDetails class has these types of members:

Properties

The SearchPaneQueryLinguisticDetails class has these properties.

PropertyAccess typeDescription

QueryTextAlternatives

Read-only

A list of the text alternatives for the current query text. These alternatives account for uncomposed text the user is entering in an IME.

QueryTextCompositionLength

Read-only

The length of the portion of the query text that the user is composing with an Input Method Editor (IME).

QueryTextCompositionStart

Read-only

The starting location of the text that the user is composing with an Input Method Editor (IME).

 

Remarks

An app retrieves this object through the searchPaneQueryChangedEventArgs.linguisticDetails property while handling a querychanged event or through the searchPaneSuggestionsRequestedEventArgs.linguisticDetails property while handling a suggestionsrequested event.

Examples

The Search contract sample demonstrates how to respond to a suggestionsrequested event, including how to access the event's linguistic details.


private void OnSearchPaneSuggestionsRequested(SearchPane sender, SearchPaneSuggestionsRequestedEventArgs e)
{
    var queryText = e.QueryText;
    if (string.IsNullOrEmpty(queryText))
    {
        MainPage.Current.NotifyUser("Use the search pane to submit a query", NotifyType.StatusMessage);
    }
    else
    {
        var request = e.Request;
        var linguisticDetails = e.LinguisticDetails;
        foreach (string alternative in linguisticDetails.QueryTextAlternatives)
        {
            foreach (string suggestion in suggestionList)
            {
                if (suggestion.StartsWith(alternative, StringComparison.CurrentCultureIgnoreCase))
                {
                    // Add suggestion to Search Pane
                    request.SearchSuggestionCollection.AppendQuerySuggestion(suggestion);

                    // Break since the Search Pane can show at most 5 suggestions
                    if (request.SearchSuggestionCollection.Size >= MainPage.SearchPaneMaxSuggestions)
                    {
                        break;
                    }
                }
            }

            // Break since the Search Pane can show at most 5 suggestions
            if (request.SearchSuggestionCollection.Size >= MainPage.SearchPaneMaxSuggestions)
            {
                break;
            }
        }

        if (request.SearchSuggestionCollection.Size > 0)
        {
            MainPage.Current.NotifyUser("Suggestions provided for query: " + queryText, NotifyType.StatusMessage);
        }
        else
        {
            MainPage.Current.NotifyUser("No suggestions provided for query: " + queryText, NotifyType.StatusMessage);
        }
    }
}


Requirements (Windows 10 device family)

Device family

Universal, introduced version 10.0.10240.0

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

Windows.ApplicationModel.Search
Windows::ApplicationModel::Search [C++]

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

Minimum supported phone

None supported

Namespace

Windows.ApplicationModel.Search
Windows::ApplicationModel::Search [C++]

Metadata

Windows.winmd

Attributes

[MarshalingBehavior(Agile)]
[Version(0x06020000)]

See also

Object
Search contract sample
SearchPane.QueryChanged event
SearchPaneQueryChangedEventArgs class
SearchPaneQueryChangedEventArgs.LinguisticDetails property
SearchPane.SuggestionsRequested event
SearchPaneSuggestionsRequestedEventArgs class
SearchPaneSuggestionsRequestedEventArgs.LinguisticDetails property

 

 

Show:
© 2016 Microsoft