New to Telerik UI for WinFormsStart a free 30-day trial

WinForms Chat Speech-to-Text Integration

Updated on May 19, 2026

RadChat provides built-in speech-to-text functionality that allows users to dictate messages using their microphone. The feature leverages the RadSpeechToTextButtonElement component, which is integrated into the chat input area through the RadPromptInputElement.

The speech-to-text feature requires the WebView2 runtime to be installed on the end user machine. Ensure that your application includes the Microsoft.Web.WebView2 NuGet package as a dependency.

Overview

The speech-to-text button is positioned in the input area buttons panel, alongside the send button. When clicked, it activates the speech recognizer which listens for voice input and inserts the recognized text into the chat input text box. The recognized text is inserted at the current caret position, allowing users to combine typed and dictated input seamlessly.

WinForms RadChat Speech-to-Text Overview

The integration supports:

  • Continuous recognition mode — the recognizer listens continuously until explicitly stopped.
  • Single utterance mode — the recognizer stops automatically after a pause in speech.
  • Configurable language — specify the recognition language via a BCP 47 language tag.
  • Visual state feedback — the button animates while actively listening.

Removing the Speech-to-Text Button

The speech-to-text button visibility is controlled by the IsSpeechToTextButtonVisible property on RadChat. By default, this property is set to true.

Toggling the speech-to-text button visibility

C#
this.radChat1.IsSpeechToTextButtonVisible = false;

Configuring the Speech Recognizer

You can configure the speech recognition behavior through the RadSpeechToTextButtonElement exposed by the prompt input element. Access it via the RadChat.ChatElement.PromptInputElement.ButtonsPanelElement.SpeechToTextButton property path.

Language Tag

Set the LanguageTag property to specify the recognition language using an IETF BCP 47 tag (for example, "en-US", "de-DE", "fr-FR").

Setting the recognition language

C#
RadSpeechToTextButtonElement sttButton = this.radChat1.ChatElement.PromptInputElement.ButtonsPanelElement.SpeechToTextButton;
sttButton.LanguageTag = "de-DE";

Continuous Recognition

The IsContinuousRecognition property determines whether the recognizer listens continuously or stops after a single utterance. The default value is true.

Disabling continuous recognition

C#
RadSpeechToTextButtonElement sttButton = this.radChat1.ChatElement.PromptInputElement.ButtonsPanelElement.SpeechToTextButton;
sttButton.IsContinuousRecognition = false;

When continuous recognition is disabled, the recognizer stops automatically after a single utterance or pause in speech.

Events

The RadSpeechToTextButtonElement exposes the following events relevant to the chat integration:

EventDescription
SpeechRecognizedRaised when the speech recognizer successfully recognizes speech. The recognized text is automatically inserted into the input text box.
StateChangedRaised when the recognizer state changes (for example, from Ready to Listening, or from Listening to StoppingListening).
ErrorOccurredRaised when an error is encountered during speech recognition initialization or processing.

Handling the SpeechRecognized Event

You can subscribe to the SpeechRecognized event to perform custom logic when the recognizer produces a result.

Subscribing to the SpeechRecognized event

C#
RadSpeechToTextButtonElement sttButton = this.radChat1.ChatElement.PromptInputElement.ButtonsPanelElement.SpeechToTextButton;
sttButton.SpeechRecognized += this.OnSpeechRecognized;

private void OnSpeechRecognized(object sender, SpeechRecognizerSpeechRecognizedEventArgs e)
{
    // e.Text contains the recognized speech
    Console.WriteLine("Recognized: " + e.Text);
}

Handling the ErrorOccurred Event

Subscribe to the ErrorOccurred event to handle initialization failures or runtime errors gracefully.

Subscribing to the ErrorOccurred event

C#
RadSpeechToTextButtonElement sttButton = this.radChat1.ChatElement.PromptInputElement.ButtonsPanelElement.SpeechToTextButton;
sttButton.ErrorOccurred += this.OnSpeechToTextError;

private void OnSpeechToTextError(object sender, SpeechRecognizerErrorOccurredEventArgs e)
{
    RadMessageBox.Show("Speech recognition error: " + e.ErrorMessage);
}

Speech Recognizer States

The button reflects the current state of the speech recognizer through visual feedback. The following table lists all possible states:

StateDescription
NotInitializedThe recognizer has not been initialized yet.
ReadyThe recognizer is initialized and ready to start listening.
StartingListeningThe recognizer is transitioning to the listening state.
ListeningThe recognizer is actively listening for speech input. The button shows a pulse animation.
StoppingListeningThe recognizer is transitioning from listening to ready.
FaultedAn error occurred during recognition.

Requirements

  • The Microsoft.Web.WebView2 NuGet package must be referenced by the project.
  • The WebView2 runtime must be available on the target machine.
  • A working microphone must be connected and accessible to the application.

See Also