SpeechGrammarSet.AddGrammarFromPredefinedType method

Creates a SpeechGrammar object by using a pre-defined grammar type, and adds it to the speech grammar set.

Syntax

public SpeechGrammar AddGrammarFromPredefinedType(
  string key, 
  SpeechPredefinedGrammar predefinedGrammarType
)
Public Function AddGrammarFromPredefinedType(
  key As String,  
  predefinedGrammarType As SpeechPredefinedGrammar 
) As SpeechGrammar
public:
SpeechGrammar^ AddGrammarFromPredefinedType(
  String^ key, 
  SpeechPredefinedGrammar predefinedGrammarType
)

Parameters

  • key
    Type: System.String [.NET] | Platform::String [C++]

    The name of the grammar.

  • predefinedGrammarType
    Type: SpeechPredefinedGrammar

    The predefined grammar type that is used when creating the SpeechGrammar object.

Return value

Type: SpeechGrammar

The grammar that is added to the speech grammar set.

Remarks

Only one pre-defined grammar type can be active at a time. This means that if you have called the AddGrammarFromPredefinedType method with a dictation or web search grammar, and then call the method again with the other pre-defined grammar type, an SPERR_GRAMMARSET_CANT_ADD error returns. To avoid this error, you can call the Clear method before switching to a new pre-defined grammar type.

For more information about how to use the AddGrammarFromPredefinedType method, see the Working with web search grammars section of Adding, loading, and preloading grammars for Windows Phone.

Requirements

Minimum supported client

None supported

Minimum supported server

None supported

Minimum supported phone

Windows Phone 8

Namespace

Windows.Phone.Speech.Recognition Windows::Phone::Speech::Recognition [C++]

Metadata

Windows.WinMD

Capabilities

ID_CAP_SPEECH_RECOGNITION [Windows Phone] ID_CAP_MICROPHONE [Windows Phone] ID_CAP_NETWORKING [Windows Phone]

See also

SpeechGrammarSet